Commit 3e346839 authored by Matthias Larisch's avatar Matthias Larisch

Fix CLI commands

parent 5aa1f844
......@@ -48,3 +48,6 @@ define('CNT_TOP', 2);
define('CNT_BOTTOM', 3);
define('CNT_LEFT', 4);
define('CNT_OVERTOP', 5);
/* this initializes the static class - can be refactored when we have DI, should be fine for now */
Foodsharing\Lib\Db\Mem::connect();
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -41,7 +41,7 @@ services:
mailqueuerunner:
container_name: foodsharing_dev_mailqueuerunner
image: registry.gitlab.com/foodsharing-dev/images/php:2.6
command: php run.php mails index
command: php run.php Mails index
working_dir: /app
links:
- maildev
......
......@@ -45,7 +45,7 @@ services:
mailqueuerunner:
container_name: foodsharing_test_mailqueuerunner
image: registry.gitlab.com/foodsharing-dev/images/php:2.6
command: php run.php mails index
command: php run.php Mails index
working_dir: /app
links:
- maildev
......
#!/bin/sh
# check if running
processes=$( ps aux |grep -e "[p]hp run.php mails[ ]*$" )
if [ -z "$processes" ]
then
echo "Socket NOT running! Restarting..."
cd /var/www/lmr-prod/www
php run.php Mails > /var/www/lmr-prod/log/fs_mails_socket.log
fi
exit 0
#!/bin/bash
cd /var/www/lmr-prod/www
php run.php Mails stop > /var/www/lmr-prod/log/fs_mails_socket.log
sleep 3
kill $(ps aux | grep '[p]hp run.php mails' | awk '{print $2}')
php run.php Mails > /var/www/lmr-prod/log/fs_mails_socket.log
......@@ -8,6 +8,7 @@ class Mem
{
public static $cache;
public static $connected;
private static $func;
public static function connect()
{
......@@ -16,6 +17,8 @@ class Mem
self::$cache = new Redis();
self::$cache->connect(REDIS_HOST, REDIS_PORT);
}
global $g_func;
self::$func = $g_func;
}
// Set a key to a value, ttl in seconds
......@@ -116,17 +119,17 @@ class Mem
{
global $g_page_cache_suffix;
return self::get('pc-' . $_SERVER['REQUEST_URI'] . ':' . $this->func->fsId());
return self::get('pc-' . $_SERVER['REQUEST_URI'] . ':' . self::$func->fsId());
}
public static function setPageCache($page, $ttl)
{
return self::set('pc-' . $_SERVER['REQUEST_URI'] . ':' . $this->func->fsId(), $page, $ttl);
return self::set('pc-' . $_SERVER['REQUEST_URI'] . ':' . self::$func->fsId(), $page, $ttl);
}
public static function delPageCache($page)
{
return self::del('pc-' . $page . ':' . $this->func->fsId());
return self::del('pc-' . $page . ':' . self::$func->fsId());
}
/**
......@@ -152,6 +155,3 @@ class Mem
return false;
}
}
/* this initializes the static class - can be refactored when we have DI, should be fine for now */
Mem::connect();
......@@ -18,6 +18,10 @@ class ConsoleControl
}
}
public function index()
{
}
public function getSubFunc()
{
return false;
......
......@@ -13,15 +13,12 @@ use Foodsharing\Modules\Mailbox\MailboxModel;
class EmailControl extends Control
{
private $mbmodel;
private $v_utils;
public function __construct()
{
global $g_view_utils;
parent::__construct();
$this->model = new Model();
$this->mbmodel = new MailboxModel();
$this->v_utils = $g_view_utils;
if (!S::may('orga')) {
$this->func->go('/');
......
......@@ -23,14 +23,6 @@ class MailsControl extends ConsoleControl
parent::__construct();
}
/**
* default method starts the server.
*/
public function index()
{
$this->queueWorker();
}
public function queueWorker()
{
while (1) {
......
......@@ -12,7 +12,6 @@ class RegionControl extends Control
private $bot_theme;
private $mode;
private $themes_per_page;
private $v_utils;
public function __construct()
{
......@@ -21,8 +20,6 @@ class RegionControl extends Control
$this->model = new RegionModel($this->themes_per_page);
$this->view = new RegionView();
$this->view->setMode($this->mode);
global $g_view_utils;
$this->v_utils = $g_view_utils;
parent::__construct();
if (!S::may()) {
......
......@@ -13,11 +13,8 @@ class StoreControl extends Control
$this->func->goLogin();
}
global $g_view_utils;
$this->model = new StoreModel();
$this->view = new StoreView();
$this->v_utils = $g_view_utils;
parent::__construct();
}
......
......@@ -5,4 +5,4 @@ $I->am('Cron');
$I->wantTo('see that mailbox update method exists and starts, without caring for any errors');
$I->amInPath('');
$I->runShellCommand('php -f run.php Mails mailboxupdate', false);
$I->seeInShellOutput('Starting mails::mailboxupdate...');
$I->seeInShellOutput('Starting Mails::mailboxupdate...');
......@@ -5,4 +5,4 @@ $I->am('Cron');
$I->wantTo('see that maintenance jobs do execute');
$I->amInPath('');
$I->runShellCommand('php -f run.php Maintenance daily');
$I->seeInShellOutput('Starting maintenance::daily...');
$I->seeInShellOutput('Starting Maintenance::daily...');
......@@ -5,8 +5,8 @@ $I->am('Cron');
$I->wantTo('see that stat generation jobs do execute');
$I->amInPath('');
$I->runShellCommand('php -f run.php Stats bezirke');
$I->seeInShellOutput('Starting stats::bezirke...');
$I->seeInShellOutput('Starting Stats::bezirke...');
$I->runShellCommand('php -f run.php Stats betriebe');
$I->seeInShellOutput('Starting stats::betriebe...');
$I->seeInShellOutput('Starting Stats::betriebe...');
$I->runShellCommand('php -f run.php Stats foodsaver');
$I->seeInShellOutput('Starting stats::foodsaver...');
$I->seeInShellOutput('Starting Stats::foodsaver...');
......@@ -19,11 +19,11 @@ require_once 'lang/DE/de.php';
$action = $_GET['f'];
$model = new Model();
$db = new Model();
$model->updateActivity();
$db->updateActivity();
if (isset($_GET['f'])) {
$xhr = new XhrMethods($model);
$xhr = new XhrMethods($db);
$func = 'xhr_' . $action;
if (method_exists($xhr, $func)) {
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment