-
Notifications
You must be signed in to change notification settings - Fork 4
Scheduler #270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main-orig
Are you sure you want to change the base?
Scheduler #270
Conversation
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
Typo corrections
…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.
Oai updates
1. Created new class string utils 1. Added todos for removing, refactoring
MySQL needs updated on the servers
* 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); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 "); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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);
}
}
public_html/crons/runcrons.php
Outdated
| } | ||
| } | ||
|
|
||
| if ($runjob) { |
There was a problem hiding this comment.
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 { | |||
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
set the current folder instead of setting $cronsPath.
working scheduler ready for code review.