Browse Source

We now are having a "scripts" folder

pull/3920/head
Michael 3 years ago
parent
commit
cabfcfc904
6 changed files with 64 additions and 83 deletions
  1. +0
    -12
      boot.php
  2. +0
    -70
      include/dbstructure.php
  3. +0
    -0
      scripts/daemon.php
  4. +63
    -0
      scripts/dbstructure.php
  5. +0
    -0
      scripts/worker.php
  6. +1
    -1
      src/Core/Worker.php

+ 0
- 12
boot.php View File

@ -1064,18 +1064,6 @@ function get_max_import_size()
return ((x($a->config, 'max_import_size')) ? $a->config['max_import_size'] : 0 );
}
/**
* @brief compatibilty wrapper for Worker::add function
*
* @param (integer|array) priority or parameter array, strings are deprecated and are ignored
*
* @return boolean "false" if proc_run couldn't be executed
*/
function proc_run()
{
$proc_args = func_get_args();
call_user_func_array('Friendica\Core\Worker::add', $proc_args);
}
function current_theme()
{


+ 0
- 70
include/dbstructure.php View File

@ -1757,73 +1757,3 @@ function db_definition() {
return($database);
}
/*
* run from command line
*/
function dbstructure_run(&$argv, &$argc) {
global $a;
if (empty($a)) {
$a = new App(dirname(__DIR__));
}
@include ".htconfig.php";
require_once "include/dba.php";
dba::connect($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
if ($argc == 2) {
switch ($argv[1]) {
case "dryrun":
update_structure(true, false);
return;
case "update":
update_structure(true, true);
$build = Config::get('system','build');
if (!x($build)) {
Config::set('system', 'build', DB_UPDATE_VERSION);
$build = DB_UPDATE_VERSION;
}
$stored = intval($build);
$current = intval(DB_UPDATE_VERSION);
// run any left update_nnnn functions in update.php
for ($x = $stored; $x < $current; $x ++) {
$r = run_update_function($x);
if (!$r) {
break;
}
}
Config::set('system','build',DB_UPDATE_VERSION);
return;
case "dumpsql":
print_structure(db_definition());
return;
case "toinnodb":
convert_to_innodb();
return;
}
}
// print help
echo $argv[0]." <command>\n";
echo "\n";
echo "Commands:\n";
echo "dryrun show database update schema queries without running them\n";
echo "update update database schema\n";
echo "dumpsql dump database schema\n";
echo "toinnodb convert all tables from MyISAM to InnoDB\n";
return;
}
if (array_search(__FILE__,get_included_files())===0) {
dbstructure_run($_SERVER["argv"],$_SERVER["argc"]);
killme();
}

util/daemon.php → scripts/daemon.php View File


+ 63
- 0
scripts/dbstructure.php View File

@ -0,0 +1,63 @@
<?php
/**
* @file scripts/dbstructure.php
* @brief Does database updates from the command line
*/
require_once 'include/dbstructure.php';
use Friendica\App;
$a = new App(dirname(__DIR__));
@include ".htconfig.php";
require_once "include/dba.php";
dba::connect($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
if ($_SERVER["argc"] == 2) {
switch ($_SERVER["argv"][1]) {
case "dryrun":
update_structure(true, false);
return;
case "update":
update_structure(true, true);
$build = Config::get('system','build');
if (!x($build)) {
Config::set('system', 'build', DB_UPDATE_VERSION);
$build = DB_UPDATE_VERSION;
}
$stored = intval($build);
$current = intval(DB_UPDATE_VERSION);
// run any left update_nnnn functions in update.php
for ($x = $stored; $x < $current; $x ++) {
$r = run_update_function($x);
if (!$r) {
break;
}
}
Config::set('system','build',DB_UPDATE_VERSION);
return;
case "dumpsql":
print_structure(db_definition());
return;
case "toinnodb":
convert_to_innodb();
return;
}
}
// print help
echo $_SERVER["argv"][0]." <command>\n";
echo "\n";
echo "Commands:\n";
echo "dryrun show database update schema queries without running them\n";
echo "update update database schema\n";
echo "dumpsql dump database schema\n";
echo "toinnodb convert all tables from MyISAM to InnoDB\n";
killme();

include/poller.php → scripts/worker.php View File


+ 1
- 1
src/Core/Worker.php View File

@ -912,7 +912,7 @@ class Worker {
}
public static function spawnWorker() {
$args = array("include/poller.php", "no_cron");
$args = array("scripts/worker.php", "no_cron");
get_app()->proc_run($args);
}


Loading…
Cancel
Save