proc_run is not needed anymore
This commit is contained in:
parent
478e363967
commit
9039e60a06
88
boot.php
88
boot.php
|
@ -1030,94 +1030,6 @@ function get_max_import_size() {
|
|||
return ((x($a->config, 'max_import_size')) ? $a->config['max_import_size'] : 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief deprecated function to add actions to the workerqueue
|
||||
*
|
||||
* Please user Worker::add instead. This function here is only needed, since it is still called by the twitter addon.
|
||||
* It can be safely removed after the next release.
|
||||
*
|
||||
* @param (integer|array) priority or parameter array, $cmd atrings are deprecated and are ignored
|
||||
*
|
||||
* next args are passed as $cmd command line
|
||||
* or: proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
||||
* or: proc_run(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), "include/create_shadowentry.php", $post_id);
|
||||
*
|
||||
* @note $cmd and string args are surrounded with ""
|
||||
*
|
||||
* @hooks 'proc_run'
|
||||
* array $arr
|
||||
*
|
||||
* @return boolean "false" if proc_run couldn't be executed
|
||||
*/
|
||||
function proc_run($cmd) {
|
||||
|
||||
$a = get_app();
|
||||
|
||||
$proc_args = func_get_args();
|
||||
|
||||
$args = array();
|
||||
if (!count($proc_args)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Preserve the first parameter
|
||||
// It could contain a command, the priority or an parameter array
|
||||
// If we use the parameter array we have to protect it from the following function
|
||||
$run_parameter = array_shift($proc_args);
|
||||
|
||||
// expand any arrays
|
||||
foreach ($proc_args as $arg) {
|
||||
if (is_array($arg)) {
|
||||
foreach ($arg as $n) {
|
||||
$args[] = $n;
|
||||
}
|
||||
} else {
|
||||
$args[] = $arg;
|
||||
}
|
||||
}
|
||||
|
||||
// Now we add the run parameters back to the array
|
||||
array_unshift($args, $run_parameter);
|
||||
|
||||
$arr = array('args' => $args, 'run_cmd' => true);
|
||||
|
||||
call_hooks("proc_run", $arr);
|
||||
if (!$arr['run_cmd'] || ! count($args)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$priority = PRIORITY_MEDIUM;
|
||||
$created = datetime_convert();
|
||||
|
||||
if (is_int($run_parameter)) {
|
||||
$priority = $run_parameter;
|
||||
} elseif (is_array($run_parameter)) {
|
||||
if (isset($run_parameter['priority'])) {
|
||||
$priority = $run_parameter['priority'];
|
||||
}
|
||||
if (isset($run_parameter['created'])) {
|
||||
$created = $run_parameter['created'];
|
||||
}
|
||||
}
|
||||
|
||||
$argv = $args;
|
||||
array_shift($argv);
|
||||
|
||||
$parameters = json_encode($argv);
|
||||
$found = dba::exists('workerqueue', array('parameter' => $parameters, 'done' => false));
|
||||
|
||||
// Quit if there was a database error - a precaution for the update process to 3.5.3
|
||||
if (dba::errorNo() != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$found) {
|
||||
dba::insert('workerqueue', array('parameter' => $parameters, 'created' => $created, 'priority' => $priority));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function current_theme() {
|
||||
$app_base_themes = array('duepuntozero', 'dispy', 'quattro');
|
||||
|
||||
|
|
Loading…
Reference in a new issue