Skip to content

Conversation

@trmccormick
Copy link
Member

working scheduler ready for code review.

MichaelRBond and others added 30 commits December 10, 2016 19:02
Add two new options to the form to designate as exporting to public, and designate the form as OAI. These are required to properly export metadata to the OAI server. Otherwise we do not know if 1) a form is ready for release to the public, and 2) if a form is supposed to be indexed in the OAI server for ppublic harvisting.

Having both options, plus individual exporting options n each record, it allows for fine tuning the automatic OAI harvisting.

The exporting class should be updated to make use of export to public. 

This feature differs from "Production Ready" in that production ready allows staff to enter data into the form. Allow release to public is when the form is ready for exporting as public consumption.
Update git ignore in develop.
Add Public Export and OAI form metadata options
…tandards

Remove spaces around metadata standards
Also, added a fixme comment where there is a logic error that needs to be fixed.
Update the download all files location
Retrieve an object with its IDNO, instead of the system ObjectID
This is provided so that import scripts for other systems ca update MFCS with regards to where the object is viewable by the public.
forms class file should be broken up. It is currently handling two distinct functions 

1. building and taking web form submissions 
1. handling everything about a "form" 

A place holder file has been created, called web_forms.php to support the refactoring
This is essential when getting all objects on systems with limited memory. Cache drastically speeds up many operations, but in some cases is not required.
Accepts parameter to exclude metadata objects
1. Add ability to add a public release select box to object forms.
1. Add ability to set the default value of yes/no to public release select
1. add public release to the object create/update forms

Note: when this gets merged into master someone will have to update all of the forms and the export forms. Any form with "publicRelease" will need that removed from the form. 

Any exports that use public release will need to be updated.
This is required because some fields may be tagged for public release, to a local repository, but should not be included in an OAI release. this could be the case, especially, if there are multiple digital object fields. The public release can be utilized to export all digital objects, but then be hidden from OAI and a single URL can be provided for the item.
1. Created new class string utils
1. Added todos for removing, refactoring
MichaelRBond and others added 14 commits April 2, 2017 07:08
* Add endpoint to pull Object IDNOs that belong to a project
* Add endpoint to pull Object IDNOs that belong to a project

* Path correction

* Correct $engine variable

* Check for existence of project

* Sql correction

* Correct coppy and paste error

* Typo
* Changing JavaScript to reveal fields.

* Fix incorrect number of fields on form insert

* Display selected option text ...

instead of ID number, for select fields in metadata forms

* Bug FIx: Correct issue where adding an element to a metadata form would remove it from production
1. addd public url & oai to object view page
working version of scheduler with changes.

$tableName = "scheduler";
$cronsPath = "/vagrant/public_html/crons";
$s = new scheduler($cronsPath);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better variable name, $s tells us nothing.

include("../../header.php");
include("../../includes/classes/scheduler.php");

//Permissions Access
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this logic be redacted to an include file so that it is not intermixed with the view? If not then it is fine, but thinking about maintainability and future thought we want to keep logic separate from views as much as possible.

// Turn off EngineAPI template engine
$engine->obCallback = FALSE;

$sql = sprintf("SELECT * FROM `scheduler` WHERE `active` = 1 ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being sprintf? Your not formatting anything and your not putting any new statements in. A single string should suffice.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed sprintf.


if ($sqlResult['numrows'] == "0") die($today . " Nothing to do.\n");

while($row = mysql_fetch_array($sqlResult['result'], MYSQL_ASSOC)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be written better to remove some conditionals.

while($row = mysql_fetch_array($sqlResult['result'],  MYSQL_ASSOC)) {
 
   $runjob = ($row['active'] == 1 && row['runnow'] == 1) ? true : false; 
 
    // verify scheduled job exists
    if (!file_exists($row['name'])) {
      notification::notifyAdmins("MFCS Scheduler Run Failure", $row['name'] , "Scheduled Cron Job is missing");
    } else {
      $minuteset = ( ($row['minute'] == date("i")) || ($row['minute'] == '*') );
      $hourset = ( ($row['hour'] == date("G")) || ($row['hour'] == '*') );
      $dayofmonthset = ( ($row['dayofmonth'] == date("n")) || ($row['dayofmonth'] == '*') );
      $monthset = ( ($row['month'] == date("n")) || ($row['month'] == '*') );
      $dayofweekset = ( ($row['dayofweek'] == date("w")) || ($row['dayofweek'] == '*') );
      $runjob = ($minuteset && $hourset && $dayofmonthset && $monthset && $dayofweekset);
    }
  }

}
}

if ($runjob) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this being done inside the scheduler class?

@@ -0,0 +1,77 @@
<?php

class scheduler {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are none of the SQL things namespaced in the scheduler class. Even though they may be done using the command line the classes are still available.

<?php

function defineList($s, $tableName) {
$l = new listManagement($tableName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$l 

What does that mean, be descriptive enough naming your variables that someone can read it in a natural language to get an idea of what is going on with the code.

<li><a href="{local var="siteRoot"}admin/metadataSchema/"> <i class="fa fa-angle-double-right"></i> Metadata Schemas </a></li>
<li><a href="{local var="siteRoot"}admin/obsoleteFileTypes/"> <i class="fa fa-angle-double-right"></i> Obsolete File Types </a></li>
<li><a href="{local var="siteRoot"}admin/projects/"><i class="fa fa-angle-double-right"></i> Projects</a></li>
<li><a href="{local var="siteRoot"}admin/readonly/"><i class="fa fa-angle-double-right"></i> Read Only</a></li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of the i tags need to be changed to spans. is inaccessible use span. This was probably done before you and you were mimicking what was there, but span is the appropriate usage.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done replaced all i tags to span.

moved several items from runcrons to scheduler class.
set the current folder instead of setting $cronsPath.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants