]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/CronJobs.php
Fix: some selected item fields hadn't been selected
[friendica.git] / src / Worker / CronJobs.php
index 5487b35d6725d35597e8ecb566350d9907a4f20d..2a6c97e84299a53a34bf8c1632cb8744f53fa645 100644 (file)
@@ -1,14 +1,29 @@
 <?php
 /**
- * @file src/worker/CronJobs.php
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  */
+
 namespace Friendica\Worker;
 
 use Friendica\App;
-use Friendica\Core\Config;
 use Friendica\Core\Logger;
 use Friendica\Core\Protocol;
-use Friendica\Core\StorageManager;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 use Friendica\Database\PostUpdate;
@@ -69,10 +84,6 @@ class CronJobs
                                self::clearCache($a);
                                break;
 
-                       case 'repair_diaspora':
-                               self::repairDiaspora($a);
-                               break;
-
                        case 'repair_database':
                                self::repairDatabase();
                                break;
@@ -226,47 +237,7 @@ class CronJobs
                        }
                }
 
-               Config::set('system', 'cache_last_cleared', time());
-       }
-
-       /**
-        * Repair missing values in Diaspora contacts
-        *
-        * @param App $a
-        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
-        * @throws \ImagickException
-        */
-       private static function repairDiaspora(App $a)
-       {
-               $starttime = time();
-
-               $r = q("SELECT `id`, `url` FROM `contact`
-                       WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
-                               ORDER BY RAND() LIMIT 50", DBA::escape(Protocol::DIASPORA));
-               if (!DBA::isResult($r)) {
-                       return;
-               }
-
-               foreach ($r as $contact) {
-                       // Quit the loop after 3 minutes
-                       if (time() > ($starttime + 180)) {
-                               return;
-                       }
-
-                       if (!GServer::reachable($contact["url"])) {
-                               continue;
-                       }
-
-                       $data = Probe::uri($contact["url"]);
-                       if ($data["network"] != Protocol::DIASPORA) {
-                               continue;
-                       }
-
-                       Logger::log("Repair contact " . $contact["id"] . " " . $contact["url"], Logger::DEBUG);
-                       q("UPDATE `contact` SET `batch` = '%s', `notify` = '%s', `poll` = '%s', pubkey = '%s' WHERE `id` = %d",
-                               DBA::escape($data["batch"]), DBA::escape($data["notify"]), DBA::escape($data["poll"]), DBA::escape($data["pubkey"]),
-                               intval($contact["id"]));
-               }
+               DI::config()->set('system', 'cache_last_cleared', time());
        }
 
        /**