mirror of
https://github.com/friendica/friendica
synced 2025-04-26 15:50:10 +00:00
modded scripts to be runned in cli so they can be included and executed in main program
This commit is contained in:
parent
517d6812da
commit
ef33ca6750
4 changed files with 88 additions and 50 deletions
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once("boot.php");
|
||||
|
||||
function update_queue_time($id) {
|
||||
logger('queue: requeue item ' . $id);
|
||||
|
@ -16,14 +16,19 @@ function remove_queue_item($id) {
|
|||
);
|
||||
}
|
||||
|
||||
require_once("boot.php");
|
||||
function queue_run($argv, $argc){
|
||||
global $a, $db;
|
||||
|
||||
$a = new App;
|
||||
|
||||
@include(".htconfig.php");
|
||||
require_once("dba.php");
|
||||
$db = new dba($db_host, $db_user, $db_pass, $db_data);
|
||||
unset($db_host, $db_user, $db_pass, $db_data);
|
||||
if(is_null($a)){
|
||||
$a = new App;
|
||||
}
|
||||
|
||||
if(is_null($db)){
|
||||
@include(".htconfig.php");
|
||||
require_once("dba.php");
|
||||
$db = new dba($db_host, $db_user, $db_pass, $db_data);
|
||||
unset($db_host, $db_user, $db_pass, $db_data);
|
||||
};
|
||||
|
||||
|
||||
require_once("session.php");
|
||||
|
@ -51,7 +56,7 @@ function remove_queue_item($id) {
|
|||
$r = q("SELECT `id` FROM `queue` WHERE `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ");
|
||||
|
||||
if(! count($r)){
|
||||
killme(); return;
|
||||
return;
|
||||
}
|
||||
// delivery loop
|
||||
|
||||
|
@ -118,7 +123,11 @@ function remove_queue_item($id) {
|
|||
}
|
||||
}
|
||||
|
||||
killme();
|
||||
return;
|
||||
|
||||
// NOTREACHED
|
||||
}
|
||||
|
||||
if (array_search(__file__,get_included_files())===0){
|
||||
queue_run($argv,$argc);
|
||||
killme();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue