]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Some more improvements
[friendica.git] / boot.php
index 89ee8115ba171edd4642ebe1d93e5ee390b69ab5..35c37d715ea07909bb5f8f0623ec3dd3571d0fc2 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -22,7 +22,6 @@ require_once(__DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'a
 
 use Friendica\App;
 use Friendica\Core\System;
-use Friendica\Core\Worker;
 use Friendica\Core\Config;
 use Friendica\Util\Lock;
 
@@ -1031,91 +1030,15 @@ function get_max_import_size() {
 }
 
 /**
- * @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.
+ * @brief compatibilty wrapper for Worker::add function
  *
  * @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();
-
+function proc_run() {
        $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;
+       call_user_func_array('Friendica\Core\Worker::add', $proc_args);
 }
 
 function current_theme() {