<?php if (!defined("IN_EXM")) { exit(1); } if ($login->isUserLoggedIn() === false) { exit(1); } // Get project id $pid = getPID(); // Get submission id if (isset($_GET['sid']) && intval($_GET['sid']) > 0) { $sid = intval($_GET['sid']); } else { exit('Invalid id!'); } // Get the project $project = new Project($pid); // Get the submission $submission = $project->getSubmission($sid); // Test permissions if (!$GLOBALS['user']->hasPrivilege("canGradeProjects")) { header("Location: ?view=accessdenied"); exit; } $tableTE = array(1 => 'Reviewer', 2 => 'Process', 3 => 'Content', 4 => 'Contribution', 5 => 'Presentation', 6 => 'Grade'); $tablePP = array(1 => 'Reviewer', 2 => 'Process', 3 => 'Content', 4 => 'Presentation', 5 => 'Grade'); $dataSent = 0; $reviews = array(); foreach ($submission->getReview() as $key => $value) { $id = $submission->getLatestReview($key);
function run() { $sock = new sockets(); $PhileSizeCpuLimit = $sock->GET_INFO("PhileSizeCpuLimit"); if ($PhileSizeCpuLimit == null) { $PhileSizeCpuLimit = 0; } if (InMemQUestion()) { writelogs("Already running, aborting", __FUNCTION__, __FILE__, __LINE__); return null; } chdir("/usr/share/artica-postfix/bin"); $unix = new unix(); $tmpfile = $unix->FILE_TEMP(); $cmd = $unix->find_program("nohup") . " /usr/share/artica-postfix/bin/philesight --db /opt/artica/philesight/database.db --index / >{$tmpfile} &"; echo $cmd . "\n"; shell_exec($cmd); sleep(3); $f = explode("\n", @file_get_contents($tmpfile)); @unlink($tmpfile); while (list($num, $ligne) = each($f)) { if (preg_match("#run database recovery#", $ligne)) { $corrupted = true; } } if ($corrupted) { @unlink("/opt/artica/philesight/database.db"); shell_exec($cmd); } if ($PhileSizeCpuLimit == 0) { return; } sleep(3); $pid = getPID(); echo "Pid={$pid}\n"; if ($pid > 2) { $cpulimit = $unix->find_program("cpulimit"); echo "cpulimit={$cpulimit}\n"; if (is_file($cpulimit)) { $cmd_limit = "{$cpulimit} -p {$pid} -l {$PhileSizeCpuLimit} -z >>/var/log/cpulimit 2>&1 &"; sleep(1); echo $cmd_limit . "\n"; shell_exec($cmd_limit); } } }
include_once dirname(__FILE__) . '/ressources/class.ini.inc'; include_once dirname(__FILE__) . '/framework/class.unix.inc'; if ($argv[1] == '--check') { check(); die; } if ($argv[1] == '--exists') { InMemQUestion(); die; } if ($argv[1] == '--rebuild') { run(); die; } if ($argv[1] == '--pid') { echo getPID() . "\n"; die; } if ($argv[1] == '--run') { echo run() . "\n"; die; } if ($argv[1] == '--directories') { scan_directories() . "\n"; die; } if ($argv[1] == '--diskof') { diskof($argv[2]) . "\n"; die; } function check()