dbupdate now moved as well
authorMichael <heluecht@pirati.ca>
Sat, 18 Nov 2017 07:31:33 +0000 (07:31 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 18 Nov 2017 07:31:33 +0000 (07:31 +0000)
boot.php
include/dbupdate.php [deleted file]
src/Worker/Cron.php
src/Worker/CronHooks.php
src/Worker/DBClean.php
src/Worker/DBUpdate.php [new file with mode: 0644]

index 8492701..52026a7 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -630,7 +630,7 @@ function check_db($via_worker)
        }
        if ($build != DB_UPDATE_VERSION) {
                // When we cannot execute the database update via the worker, we will do it directly
-               if (!Worker::add(PRIORITY_CRITICAL, 'dbupdate') && $via_worker) {
+               if (!Worker::add(PRIORITY_CRITICAL, 'DBUpdate') && $via_worker) {
                        update_db(get_app());
                }
        }
diff --git a/include/dbupdate.php b/include/dbupdate.php
deleted file mode 100644 (file)
index 799ca26..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-use Friendica\Core\Config;
-
-function dbupdate_run(&$argv, &$argc) {
-       global $a;
-
-       // We are deleting the latest dbupdate entry.
-       // This is done to avoid endless loops because the update was interupted.
-       Config::delete('database', 'dbupdate_'.DB_UPDATE_VERSION);
-
-       update_db($a);
-}
index 1893a86..21b7690 100644 (file)
@@ -1,4 +1,7 @@
 <?php
+/**
+ * @file src/Worker/Cron.php
+ */
 namespace Friendica\Worker;
 
 use Friendica\Core\Config;
index 42670eb..2210993 100644 (file)
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file src/Worker/CronHooks.php
+ */
+
 namespace Friendica\Worker;
 
 use Friendica\Core\Config;
index 94295b0..7030081 100644 (file)
@@ -4,6 +4,8 @@
  * @brief The script is called from time to time to clean the database entries and remove orphaned data.
  */
 
+namespace Friendica\Worker;
+
 use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use dba;
diff --git a/src/Worker/DBUpdate.php b/src/Worker/DBUpdate.php
new file mode 100644 (file)
index 0000000..0e1c985
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+/**
+ * @file src/Worker/DBUpdate.php
+ * @brief This file is called when the database structure needs to be updated
+ */
+namespace Friendica\Worker;
+
+use Friendica\Core\Config;
+
+class DBUpdate {
+       public static function execute() {
+               // We are deleting the latest dbupdate entry.
+               // This is done to avoid endless loops because the update was interupted.
+               Config::delete('database', 'dbupdate_'.DB_UPDATE_VERSION);
+
+               update_db($a);
+       }
+}