public function testGetValidName() { global $db_config; // Create the Array fixture. $fixture = array(); $mgr = new TaskManager($db_config); // Assert that the size of the Array fixture is 0. $this->assertEquals("Cody", $mgr->get_name()); }
public function __construct($id) { if (!TaskManager::existsById($id)) { die("Task wurde mit falscher ID erstellt."); } $con = Database::getCon(); $res = $con->query("SELECT * FROM tasks WHERE id = {$id}") or die(mysqli_error($con)); $this->Data = $res->fetch_array(); }
public function deleteSync() { if (TaskManager::check($this->sync_id)) { TaskManager::delete($this->sync_id); } if (TaskManager::check($this->db_backup_id)) { TaskManager::delete($this->db_backup_id); } if (TaskManager::check($this->heartbeat_id)) { TaskManager::delete($this->heartbeat_id); } }
} } spl_autoload_register("classLoad"); include '../config.php'; include '../lib/image-processing.php'; //classes loading end session_start(); //post input processing $action = htmlentities($_POST['action']); //This var contains result message of CRUD action $actionMessage = ""; $typeMessage = ""; //Component Class Manager //The History Component is used in all ActionControllers to mention a historical version of each action $historyManager = new HistoryManager($pdo); $taskManager = new TaskManager($pdo); //Action Add Processing Begin if ($action == "add") { if (!empty($_POST['user'])) { $user = htmlentities($_POST['user']); $content = htmlentities($_POST['content']); $status = htmlentities($_POST['status']); $createdBy = $_SESSION['userMerlaTrav']->login(); $created = date('Y-m-d h:i:s'); //create object $task = new Task(array('user' => $user, 'content' => $content, 'status' => 0, 'created' => $created, 'createdBy' => $createdBy)); //add it to db $taskManager->add($task); //add History data $history = new History(array('action' => "Ajout", 'target' => "Table des tâches", 'description' => "Ajouter une nouvelle tâche", 'created' => $created, 'createdBy' => $createdBy)); //add it to db
protected function clearCronTask($id) { if (TaskManager::check($id) === true) { TaskManager::delete($id); } if ($pid = $this->getSynsStatusCommandPid()) { ProcessPid::killProcess($pid); $this->_configForm->updateParam('SYNS_STATUS_COMMAND_PID', false); // $this->_configForm->updateParam('MASTER_TCP_SERVER_COMMAND_PID',false); $this->_configForm->saveToFile(); } }
public function __construct() { $this->welcomInformations(); $backupTypeU = unserialize(BACKUP_TYPE); // init task manager. $this->backupLogger = GlobalLogger::getLoggerInstance(); $this->backupDate = Utils::getDateInstance(); $tmp_tasks = array(); $taskManager = new TaskManager(); $this->taskList = $taskManager->getTasks(); $array_length = count($this->taskList); $num = 1; foreach ($this->taskList as $key => $task) { $credentialInitInfo = "\n----------------task credential init begin--------------" . "\n"; $this->backupLogger->addLog('credential init', 100, $credentialInitInfo, $task->target_host_spec->getIp()); //echo $credentialInitInfo; $task = $this->initialize_credential($task); $this->backupLogger->addLog('credential init', 100, "init....", $task->target_host_spec->getIp()); $tmp_tasks[$key] = $task; $credentialInitEndInfo = "\n----------------task credential init end----------------" . "\n\n\n\n"; $this->backupLogger->addLog('credential init', 100, $credentialInitEndInfo, $task->target_host_spec->getIp()); //echo $credentialInitEndInfo; $num++; //print_r($tmp_tasks); } //print_r($tmp_tasks); if ($num < $array_length + 1 or $num == 1) { exit("your credential is not complete, please try again!\n"); } $task_num = 1; print_r($tmp_tasks); while (1) { $total_timer = Utils::getTimer(); $total_timer->start(); foreach ($tmp_tasks as $task) { $timer = Utils::getTimer(); $host_type = $task->target_host_spec->getHost_type(); //echo $host_type . "\n"; $hostManager = new HostManager(); // srcHost $srcHost = $hostManager->get_host($host_type); //print_r($task->target_host_spec); $srcHost->hostSpec = $task->target_host_spec; $srcHost->hostCredential = $task->target_host_credential; // destHost $target_dest_ip = $task->target_host_spec->getBackup_dest_ip(); $hostSpecManager = new HostSpecManager(); $storageHostSpec = $hostSpecManager->querryHostSpecByHostIp($target_dest_ip); $storageHost = new DestHost(); $storageHost->hostSpec = $storageHostSpec; $storageHost->storageCredential = $task->storage_credential; $backupTaskInfo = "\n\n-----------------backup task {$task_num} begin-----------------\n\n"; echo "time: " . $timer->startTime; $this->backupLogger->addLog('backup task', 100, $backupTaskInfo, $srcHost->hostSpec->getIp()); echo $backupTaskInfo; $backupHandlerManager = new BackupHandlerManager(); $backupType = $this->getBackupType($srcHost); $db_inputs = array(); if ($backupType == $backupTypeU[1]) { echo "This is a MySQLdb backup ....\n"; $db_inputs = $this->getDBInput(); $srcHost->hostCredential->user_db = $db_inputs['username']; $srcHost->hostCredential->password_db = $db_inputs['password']; } //"linux_mysqldb"; $this->backupHandler = $backupHandlerManager->getBackupHandler($backupType); $createBackupInfo = "\n...backup handler create ok!...\n"; $this->backupLogger->addLog("backup task", 100, $createBackupInfo, $srcHost->hostSpec->getIp()); $beginBackupInfo = "\n...begin execute backup task!...\n"; $this->backupLogger->addLog("backup task", 100, $beginBackupInfo, $srcHost->hostSpec->getIp()); $begin_time = microtime(true); $timer->start(); $this->backupHandler->execute($srcHost, $storageHost, $this->backupLogger); $timer->stop(); echo "time: " . $timer->stopTime; $total_time = $timer->spent(); echo "\nUsed time: " . $total_time . "\n\n"; $endInfo = "\n-----------------backup task {$task_num} end-------------------\n\n\n\n\n"; $this->backupLogger->addLog("backup task", 100, $endInfo, $srcHost->hostSpec->getIp()); echo $endInfo; $task_num++; } $total_timer->stop(); $spent_time = $total_timer->total_time_H(); echo "\n\n ############# all time spent {$spent_time} H #############\n\n"; if ($spent_time > 24) { echo "\nBigger than 24 hours.\n"; $sleep_time = (48 - $spent_time) * 3600; echo "sleep {$spent_time} s"; sleep($sleep_time); } elseif ($spent_time <= 24) { $sleep_time = (24 - $spent_time) * 3600; echo "sleep {$sleep_time} s"; sleep($sleep_time); } } }
?> </th> <td><?php echo CHtml::activeTextField($conf_form, 'sync_max_row', array('style' => 'width: 50px;')); ?> <?php echo CHtml::activeLabel($conf_form, 'sync_max_row_desc'); ?> </td> <td><?php echo CHtml::error($conf_form, 'sync_max_row'); ?> </td> </tr> <tr> <th></th> <td> <?php echo CHtml::submitButton(TaskManager::check($conf_form->sync_id) ? 'Update' : 'Start', array('name' => 'save_db_sync')); ?> <?php if (TaskManager::check($conf_form->sync_id)) { echo CHtml::submitButton('Stop', array('name' => 'delete_db_sync')); } ?> </td> </tr> </table> </div>
<?php class Context { public function execute(Closure $callback) { $callback(); } } class TaskManager { protected $tasks = array('clean', 'groom'); public function execute() { $context = new Context(); $context->execute(function () { array_pop($this->tasks); echo count($this->tasks); }); } } $manager = new TaskManager(); $manager->execute();
<div class="container-fluid"> <!-- BEGIN LOGO --> <a class="brand"> <img src="assets/img/big-logo-new.png" alt="logo" /> </a> <!-- END LOGO --> <!-- BEGIN RESPONSIVE MENU TOGGLER --> <a href="javascript:;" class="btn-navbar collapsed" data-toggle="collapse" data-target=".nav-collapse"> <img src="assets/img/menu-toggler.png" alt="" /> </a> <!-- END RESPONSIVE MENU TOGGLER --> <!-- BEGIN TOP NAVIGATION MENU --> <?php //In this section we will count the number of tasks assigned to the current session user $bugManager = new BugManager($pdo); $taskManager = new TaskManager($pdo); $taskNumber = $taskManager->getTaskNumberByUser($_SESSION['userMerlaTrav']->login()); $bugNumber = $bugManager->getBugsNumber(); ?> <ul class="nav pull-right"> <li class="dropdown" id="header_inbox_bar"> <a href="tasks.php" class="dropdown-toggle"> <i class="icon-tasks"></i> <?php if ($taskNumber > 0) { ?> <span class="badge"><?php echo $taskNumber; ?> </span>
<?php /* * WolfPanel (c) 2015 by Fursystems.de (Marcel Kallen) * * WolfPanel is licensed under a * Creative Commons Attribution-NonCommercial 4.0 International License. * * You should have received a copy of the license along with this * work. If not, see <http://creativecommons.org/licenses/by-nc/4.0/>. */ $task = TaskManager::getOldestUndoneTask(); if ($task != null) { $task->execute(); }
error_reporting(E_ALL); ini_set('display_errors', '1'); } require_once "bootstrap.php"; require_once 'manager/error.manager.php'; require_once "manager/task.manager.php"; session_name($GLOBALS["canisSessionName"]); ini_set("session.gc_maxlifetime", "31449600"); session_start(); if (!$GLOBALS["debugMode"]) { error_reporting(E_ALL ^ E_NOTICE); } //$memcache = new Memcache; //$memcache>connect('127.0.0.1', 11211) or die ("Could not connect"); //Empiezo la carga de la informacion dentro de las vistas $tasManager = new TaskManager(); //--------------------------------------------------------------------- if (isset($_REQUEST['action'])) { $action = $_REQUEST['action']; switch ($action) { case "next": if (isset($_REQUEST["queue"])) { $tasManager->getNextTask($_REQUEST["queue"]); } else { $tasManager->getNextTask(); } break; case "clean": $tasManager->cleanAllTasks(); break; case "collector":
<?php Route::get('taskmanager/list/all', function () { return TaskManager::getAll(); }); Route::get('taskmanager/list/projects', function () { return TaskManager::getProjects(); }); Route::get('taskmanager/list/project/{project_id}', function ($project_id) { return TaskManager::getProject($project_id); }); Route::get('taskmanager/list/tasks/{project_id}', function ($project_id) { return TaskManager::getTasks($project_id); }); Route::get('taskmanager/delete/project/{project_id}', function ($project_id) { return TaskManager::deleteProject($project_id); }); Route::get('taskmanager/delete/task/{task_id}', function ($task_id) { return TaskManager::deleteTask($task_id); }); Route::get('taskmanager/complete/task/{task_id}', function ($task_id) { return TaskManager::completeTask($task_id); });