]> git.mxchange.org Git - friendica.git/blobdiff - include/poller.php
Replace AND and OR in PHP conditions by && and ||
[friendica.git] / include / poller.php
index a19d9dec8f70c31cb4f183ac6ea924f8ab6008ad..cc8edce656969ba4e8743adac09d479724d2edee 100644 (file)
@@ -4,7 +4,7 @@ use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Util\Lock;
 
-if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
+if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
        $directory = dirname($_SERVER["argv"][0]);
 
        if (substr($directory, 0, 1) != "/") {
@@ -75,7 +75,7 @@ function poller_run($argv, $argc){
        }
 
        // Now we start additional cron processes if we should do so
-       if (($argc <= 1) OR ($argv[1] != "no_cron")) {
+       if (($argc <= 1) || ($argv[1] != "no_cron")) {
                poller_run_cron();
        }
 
@@ -392,7 +392,7 @@ function poller_kill_stale_workers() {
                                $pid["priority"] = PRIORITY_MEDIUM;
                        }
 
-      // Define the maximum durations
+                       // Define the maximum durations
                        $max_duration_defaults = array(PRIORITY_CRITICAL => 360, PRIORITY_HIGH => 10, PRIORITY_MEDIUM => 60, PRIORITY_LOW => 180, PRIORITY_NEGLIGIBLE => 360);
                        $max_duration = $max_duration_defaults[$pid["priority"]];
 
@@ -467,7 +467,7 @@ function poller_too_much_workers() {
                $s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `executed` <= '%s'", dbesc(NULL_DATE));
                $entries = $s[0]["total"];
 
-               if (Config::get("system", "worker_fastlane", false) AND ($queues > 0) AND ($entries > 0) AND ($active >= $queues)) {
+               if (Config::get("system", "worker_fastlane", false) && ($queues > 0) && ($entries > 0) && ($active >= $queues)) {
                        $s = q("SELECT `priority` FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority` LIMIT 1", dbesc(NULL_DATE));
                        $top_priority = $s[0]["priority"];
 
@@ -475,7 +475,7 @@ function poller_too_much_workers() {
                                intval($top_priority), dbesc(NULL_DATE));
                        $high_running = dbm::is_result($s);
 
-                       if (!$high_running AND ($top_priority > PRIORITY_UNDEFINED) AND ($top_priority < PRIORITY_NEGLIGIBLE)) {
+                       if (!$high_running && ($top_priority > PRIORITY_UNDEFINED) && ($top_priority < PRIORITY_NEGLIGIBLE)) {
                                logger("There are jobs with priority ".$top_priority." waiting but none is executed. Open a fastlane.", LOGGER_DEBUG);
                                $queues = $active + 1;
                        }
@@ -484,7 +484,7 @@ function poller_too_much_workers() {
                logger("Load: ".$load."/".$maxsysload." - processes: ".$active."/".$entries.$processlist." - maximum: ".$queues."/".$maxqueues, LOGGER_DEBUG);
 
                // Are there fewer workers running as possible? Then fork a new one.
-               if (!Config::get("system", "worker_dont_fork") AND ($queues > ($active + 1)) AND ($entries > 1)) {
+               if (!Config::get("system", "worker_dont_fork") && ($queues > ($active + 1)) && ($entries > 1)) {
                        logger("Active workers: ".$active."/".$queues." Fork a new worker.", LOGGER_DEBUG);
                        $args = array("include/poller.php", "no_cron");
                        $a = get_app();
@@ -632,7 +632,7 @@ function poller_claim_process($queue) {
        if (!$id) {
                logger("Queue item ".$queue["id"]." vanished - skip this execution", LOGGER_DEBUG);
                return false;
-       } elseif ((strtotime($id[0]["executed"]) <= 0) OR ($id[0]["pid"] == 0)) {
+       } elseif ((strtotime($id[0]["executed"]) <= 0) || ($id[0]["pid"] == 0)) {
                logger("Entry for queue item ".$queue["id"]." wasn't stored - skip this execution", LOGGER_DEBUG);
                return false;
        } elseif ($id[0]["pid"] != $mypid) {