mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Merge pull request #216 from romainneutron/master
Remove latest admin files
This commit is contained in:
@@ -21,10 +21,10 @@
|
||||
"silex/silex": "1.0.*",
|
||||
"swiftmailer/swiftmailer": "4.1.*",
|
||||
"symfony/symfony": ">=2.1",
|
||||
"tcpdf/tcpdf": ">5.9",
|
||||
"twig/twig": "1.9.*",
|
||||
"twig/extensions": "master",
|
||||
"zend/gdata": ">1.11"
|
||||
"zend/gdata": ">1.11",
|
||||
"tecnick.com/tcpdf": "dev-master"
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"require-dev": {
|
||||
|
5
composer.lock
generated
5
composer.lock
generated
@@ -148,10 +148,9 @@
|
||||
"alias-version": "2.1.9999999.9999999-dev"
|
||||
},
|
||||
{
|
||||
"package": "tcpdf/tcpdf",
|
||||
"package": "tecnick.com/tcpdf",
|
||||
"version": "dev-master",
|
||||
"source-reference": "5.9.176",
|
||||
"commit-date": "1343831860"
|
||||
"source-reference": "01dc4da8b311bf81180dced43d0e8c55a9bee932"
|
||||
},
|
||||
{
|
||||
"package": "twig/extensions",
|
||||
|
@@ -4,23 +4,7 @@ rewrite ^/(download)/([a-zA-Z0-9]*)\/get$ /include/download_prepare.php?type
|
||||
rewrite ^/(mail-export)/([a-zA-Z0-9]*)\/?$ /include/download_anonymous.php?type=$1&token=$2 last;
|
||||
rewrite ^/(mail-export)/([a-zA-Z0-9]*)\/get$ /include/download_anonymous.php?type=$1&token=$2&get=1 last;
|
||||
|
||||
rewrite ^/admin/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/databox/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/sphinx/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/structure/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/collection/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/statusbit/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/dashboard/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/databoxes/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/setup/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/users/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/tests/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/fields/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/description/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/subdefs/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/publications/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/typeahead/.*$ /admin/router.php last;
|
||||
rewrite ^/admin/connected-users/.*$ /admin/router.php last;
|
||||
rewrite ^/admin.?$ /admin/router.php last;
|
||||
|
||||
rewrite ^/prod/records/edit/.*$ /prod/router.php last;
|
||||
rewrite ^/prod/records/movecollection/.*$ /prod/router.php last;
|
||||
|
@@ -41,9 +41,7 @@ return call_user_func(
|
||||
$app->mount('/setup', new Setup());
|
||||
$app->mount('/sphinx', new Sphinx());
|
||||
$app->mount('/connected-users', new ConnectedUsers());
|
||||
|
||||
$app->mount('/task-manager', new TaskManager());
|
||||
|
||||
$app->mount('/publications', new Publications());
|
||||
$app->mount('/users', new Users());
|
||||
$app->mount('/fields', new Fields());
|
||||
|
@@ -802,7 +802,7 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
$controllers->get('/import/example/csv/', function(Application $app, Request $request) {
|
||||
|
||||
$file = new \SplFileInfo($app['phraseanet.core']['Registry']->get('GV_RootPath') . 'www/admin/exampleImportUsers.csv');
|
||||
$file = new \SplFileInfo($app['phraseanet.core']['Registry']->get('GV_RootPath') . 'lib/Fixtures/exampleImportUsers.csv');
|
||||
|
||||
if ( ! $file->isFile()) {
|
||||
$app->abort(400);
|
||||
@@ -822,7 +822,7 @@ class Users implements ControllerProviderInterface
|
||||
|
||||
$controllers->get('/import/example/rtf/', function(Application $app, Request $request) {
|
||||
|
||||
$file = new \SplFileInfo($app['phraseanet.core']['Registry']->get('GV_RootPath') . 'www/admin/Fields.rtf');
|
||||
$file = new \SplFileInfo($app['phraseanet.core']['Registry']->get('GV_RootPath') . 'lib/Fixtures/Fields.rtf');
|
||||
|
||||
if ( ! $file->isFile()) {
|
||||
$app->abort(400);
|
||||
|
@@ -129,12 +129,6 @@ class gatekeeper
|
||||
case 'report':
|
||||
phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']);
|
||||
break;
|
||||
case 'admin':
|
||||
if ($this->_script_name === 'runscheduler.php') {
|
||||
return;
|
||||
}
|
||||
phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']);
|
||||
break;
|
||||
case 'login':
|
||||
if ($appbox->need_major_upgrade()) {
|
||||
phrasea::redirect("/setup/");
|
||||
|
@@ -117,7 +117,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
data["taskid"]=<?php echo $this->getID(); ?>;
|
||||
data["cls"]="RecordMover";
|
||||
data["xml"] = "<?php echo p4string::MakeString($sxml->saveXML(), "js", '"') ?>";
|
||||
parent.$.ajax({ url: "/admin/taskfacility.php"
|
||||
parent.$.ajax({ url: "/admin/task-manager/task/<?php echo $this->getID(); ?>/facility/"
|
||||
, data: data
|
||||
, dataType:'json'
|
||||
, type:"POST"
|
||||
@@ -159,7 +159,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
data["taskid"]=<?php echo $this->getID(); ?>;
|
||||
data["cls"]="RecordMover";
|
||||
data["xml"] = "<?php echo p4string::MakeString($sxml->saveXML(), "js", '"') ?>";
|
||||
parent.$.ajax({ url: "/admin/taskfacility.php"
|
||||
parent.$.ajax({ url: "/admin/task-manager/task/<?php echo $this->getID(); ?>/facility/"
|
||||
, data: data
|
||||
, dataType:'json'
|
||||
, type:"POST"
|
||||
|
@@ -1,616 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class task_period_cindexer extends task_abstract
|
||||
{
|
||||
// how to execute indexer (choose in 'run2' method)
|
||||
private $method;
|
||||
|
||||
const METHOD_FORK = 'METHOD_FORK';
|
||||
const METHOD_EXEC = 'METHOD_EXEC';
|
||||
const METHOD_PROC_OPEN = 'METHOD_PROC_OPEN';
|
||||
const ERR_EXECUTABLE_NOT_FOUND = 2; // aka ENOENT (No such file or directory)
|
||||
const ERR_CRASHED = 14; // aka EFAULT (Bad address)
|
||||
const ERR_CANT_FORK = 3; // aka ESRCH (No such process)
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $host;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $port;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $base;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $password;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $socket;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $use_sbas;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $charset;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $debugmask;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $nolog;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $winsvc_run;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $binpath;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return(_("task::cindexer:Indexation"));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function help()
|
||||
{
|
||||
return(_("task::cindexer:indexing records"));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $oldxml
|
||||
* @return string
|
||||
*/
|
||||
public function graphic2xml($oldxml)
|
||||
{
|
||||
$request = http_request::getInstance();
|
||||
|
||||
$parm2 = $request->get_parms(
|
||||
'binpath', 'host', 'port', 'base', 'user', 'password', 'socket', 'use_sbas', 'nolog', 'clng', 'winsvc_run', 'charset', 'debugmask'
|
||||
);
|
||||
$dom = new DOMDocument();
|
||||
$dom->formatOutput = true;
|
||||
if ($dom->loadXML($oldxml)) {
|
||||
$xmlchanged = false;
|
||||
foreach (array("str:binpath", "str:host", "str:port", "str:base", "str:user", "str:password", "str:socket", "boo:use_sbas", "boo:nolog", "str:clng", "boo:winsvc_run", "str:charset", 'str:debugmask') as $pname) {
|
||||
$ptype = substr($pname, 0, 3);
|
||||
$pname = substr($pname, 4);
|
||||
$pvalue = $parm2[$pname];
|
||||
if (($ns = $dom->getElementsByTagName($pname)->item(0)) != NULL) {
|
||||
// le champ existait dans le xml, on supprime son ancienne valeur (tout le contenu)
|
||||
while (($n = $ns->firstChild)) {
|
||||
$ns->removeChild($n);
|
||||
}
|
||||
} else {
|
||||
// le champ n'existait pas dans le xml, on le cr<63>e
|
||||
$ns = $dom->documentElement->appendChild($dom->createElement($pname));
|
||||
}
|
||||
// on fixe sa valeur
|
||||
switch ($ptype) {
|
||||
case "str":
|
||||
$ns->appendChild($dom->createTextNode($pvalue));
|
||||
break;
|
||||
case "boo":
|
||||
$ns->appendChild($dom->createTextNode($pvalue ? '1' : '0'));
|
||||
break;
|
||||
}
|
||||
$xmlchanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
return($dom->saveXML());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $xml
|
||||
* @param string $form
|
||||
* @return string
|
||||
*/
|
||||
public function xml2graphic($xml, $form)
|
||||
{
|
||||
if (($sxml = simplexml_load_string($xml)) != FALSE) { // in fact XML IS always valid here...
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<?php echo $form ?>.binpath.value = "<?php echo p4string::MakeString($sxml->binpath, "js", '"') ?>";
|
||||
<?php echo $form ?>.host.value = "<?php echo p4string::MakeString($sxml->host, "js", '"') ?>";
|
||||
<?php echo $form ?>.port.value = "<?php echo p4string::MakeString($sxml->port, "js", '"') ?>";
|
||||
<?php echo $form ?>.base.value = "<?php echo p4string::MakeString($sxml->base, "js", '"') ?>";
|
||||
<?php echo $form ?>.user.value = "<?php echo p4string::MakeString($sxml->user, "js", '"') ?>";
|
||||
<?php echo $form ?>.socket.value = "<?php echo p4string::MakeString($sxml->socket, "js", '"') ?>";
|
||||
<?php echo $form ?>.password.value = "<?php echo p4string::MakeString($sxml->password, "js", '"') ?>";
|
||||
<?php echo $form ?>.clng.value = "<?php echo p4string::MakeString($sxml->clng, "js", '"') ?>";
|
||||
<?php echo $form ?>.use_sbas.checked = <?php echo trim((string) $sxml->use_sbas) != '' ? (p4field::isyes($sxml->use_sbas) ? 'true' : 'false') : 'true' ?>;
|
||||
<?php echo $form ?>.nolog.checked = <?php echo p4field::isyes($sxml->nolog) ? 'true' : 'false' ?>;
|
||||
<?php echo $form ?>.winsvc_run.checked = <?php echo p4field::isyes($sxml->winsvc_run) ? 'true' : 'false' ?>;
|
||||
<?php echo $form ?>.charset.value = "<?php echo trim((string) $sxml->charset) != '' ? p4string::MakeString($sxml->charset, "js", '"') : 'utf8' ?>";
|
||||
<?php echo $form ?>.debugmask.value = "<?php echo trim((string) $sxml->debugmask) != '' ? p4string::MakeString($sxml->debugmask, "js", '"') : '0' ?>";
|
||||
parent.calccmd();
|
||||
</script>
|
||||
<?php
|
||||
|
||||
return("");
|
||||
} else { // ... so we NEVER come here
|
||||
// bad xml
|
||||
return("BAD XML");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function printInterfaceJS()
|
||||
{
|
||||
$appname = 'phraseanet_indexer';
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$appname .= '.exe';
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function calccmd()
|
||||
{
|
||||
var cmd = '';
|
||||
with(document.forms['graphicForm'])
|
||||
{
|
||||
cmd += binpath.value + "/<?php echo $appname ?>";
|
||||
if(host.value)
|
||||
cmd += " -h=" + host.value;
|
||||
if(port.value)
|
||||
cmd += " -P=" + port.value;
|
||||
if(base.value)
|
||||
cmd += " -b=" + base.value;
|
||||
if(user.value)
|
||||
cmd += " -u=" + user.value;
|
||||
if(password.value)
|
||||
cmd += " -p=" + password.value;
|
||||
if(socket.value)
|
||||
cmd += " --socket=" + socket.value;
|
||||
if(charset.value)
|
||||
cmd += " --default-character-set=" + charset.value;
|
||||
if(use_sbas.checked)
|
||||
cmd += " -o";
|
||||
if(nolog.checked)
|
||||
cmd += " -n";
|
||||
if(clng.value)
|
||||
cmd += " -c=" + clng.value;
|
||||
if(debugmask.value)
|
||||
cmd += " -d=" + debugmask.value;
|
||||
if(winsvc_run.checked)
|
||||
cmd += " --run";
|
||||
}
|
||||
document.getElementById('cmd').innerHTML = cmd;
|
||||
}
|
||||
function chgxmltxt(textinput, fieldname)
|
||||
{
|
||||
calccmd();
|
||||
setDirty();
|
||||
}
|
||||
function chgxmlck(checkinput, fieldname)
|
||||
{
|
||||
calccmd();
|
||||
setDirty();
|
||||
}
|
||||
function chgxmlpopup(popupinput, fieldname)
|
||||
{
|
||||
calccmd();
|
||||
setDirty();
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return return
|
||||
*/
|
||||
public function getInterfaceHTML()
|
||||
{
|
||||
$appname = 'phraseanet_indexer';
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$appname .= '.exe';
|
||||
}
|
||||
ob_start();
|
||||
?>
|
||||
<form name="graphicForm" onsubmit="return(false);" method="post">
|
||||
<br/>
|
||||
<?php echo _('task::cindexer:executable') ?> :
|
||||
<input type="text" name="binpath" style="width:300px;" onchange="chgxmltxt(this, 'binpath');" value=""> / <?php echo $appname ?>
|
||||
<br/>
|
||||
<?php echo _('task::cindexer:host') ?> : <input type="text" name="host" style="width:100px;" onchange="chgxmltxt(this, 'host');" value="">
|
||||
<br/>
|
||||
<?php echo _('task::cindexer:port') ?> : <input type="text" name="port" style="width:100px;" onchange="chgxmltxt(this, 'port');" value="">
|
||||
<br/>
|
||||
<?php echo _('task::cindexer:base') ?> : <input type="text" name="base" style="width:200px;" onchange="chgxmltxt(this, 'base');" value="">
|
||||
<br/>
|
||||
<?php echo _('task::cindexer:user') ?> : <input type="text" name="user" style="width:200px;" onchange="chgxmltxt(this, 'user');" value="">
|
||||
<br/>
|
||||
<?php echo _('task::cindexer:password') ?> : <input type="password" name="password" style="width:200px;" onchange="chgxmltxt(this, 'password');" value="">
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<?php echo _('task::cindexer:control socket') ?> : <input type="text" name="socket" style="width:50px;" onchange="chgxmltxt(this, 'socket');" value="">
|
||||
<br/>
|
||||
<?php echo _('task::cindexer:Debug mask') ?> : <input type="text" name="debugmask" style="width:50px;" onchange="chgxmltxt(this, 'debugmask');" value="">
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div style="display:none;">
|
||||
<input type="checkbox" name="use_sbas" onclick="chgxmlck(this, 'old');"> <?php echo _('task::cindexer:use table \'sbas\' (unchecked: use \'xbas\')') ?>
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<?php echo _('task::cindexer:MySQL charset') ?> : <input type="text" name="charset" style="width:100px;" onchange="chgxmltxt(this, 'charset');" value="">
|
||||
<br/>
|
||||
|
||||
<input type="checkbox" name="nolog" onclick="chgxmlck(this, 'nolog');"> <?php echo _('task::cindexer:do not (sys)log, but out to console)') ?>
|
||||
<br/>
|
||||
|
||||
<?php echo _('task::cindexer:default language for new candidates') ?> : <input type="text" name="clng" style="width:50px;" onchange="chgxmltxt(this, 'clng');" value="">
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<hr/>
|
||||
|
||||
<br/>
|
||||
<?php echo _('task::cindexer:windows specific') ?> :<br/>
|
||||
<input type="checkbox" name="winsvc_run" onclick="chgxmlck(this, 'run');"> <?php echo _('task::cindexer:run as application, not as service') ?>
|
||||
<br/>
|
||||
|
||||
</form>
|
||||
<br>
|
||||
<center>
|
||||
<div style="margin:10px; padding:5px; border:1px #000000 solid; font-family:monospace; font-size:16px; text-align:left; color:#00e000; background-color:#404040" id="cmd">cmd</div>
|
||||
</center>
|
||||
<?php
|
||||
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param SimpleXMLElement $sx_task_settings
|
||||
* @return task_cindexer
|
||||
*/
|
||||
protected function loadSettings(SimpleXMLElement $sx_task_settings)
|
||||
{
|
||||
$this->host = trim($sx_task_settings->host);
|
||||
$this->port = trim($sx_task_settings->port);
|
||||
$this->base = trim($sx_task_settings->base);
|
||||
$this->user = trim($sx_task_settings->user);
|
||||
$this->password = trim($sx_task_settings->password);
|
||||
$this->socket = trim($sx_task_settings->socket);
|
||||
$this->use_sbas = p4field::isyes(trim($sx_task_settings->use_sbas));
|
||||
$this->charset = trim($sx_task_settings->charset);
|
||||
$this->debugmask = (int) (trim($sx_task_settings->debugmask));
|
||||
$this->nolog = p4field::isyes(trim($sx_task_settings->nolog));
|
||||
$this->winsvc_run = p4field::isyes(trim($sx_task_settings->winsvc_run));
|
||||
$this->binpath = p4string::addEndSlash(trim($sx_task_settings->binpath));
|
||||
|
||||
parent::loadSettings($sx_task_settings);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function run2()
|
||||
{
|
||||
$cmd = $this->binpath . 'phraseanet_indexer';
|
||||
|
||||
$nullfile = '/dev/null';
|
||||
$this->method = self::METHOD_PROC_OPEN;
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$nullfile = '/dev/null';
|
||||
$cmd .= '.exe';
|
||||
}
|
||||
|
||||
if ( ! file_exists($cmd) || ! is_executable($cmd)) {
|
||||
$this->setState(self::STATE_STOPPED);
|
||||
$this->log(sprintf(_('task::cindexer:file \'%s\' does not exists'), $cmd));
|
||||
throw new Exception('cindexer executable not found', self::ERR_EXECUTABLE_NOT_FOUND);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$args = array();
|
||||
$args_nopwd = array();
|
||||
if ($this->host) {
|
||||
$args[] = '-h=' . $this->host;
|
||||
$args_nopwd[] = '-h=' . $this->host;
|
||||
}
|
||||
if ($this->port) {
|
||||
$args[] = '-P=' . $this->port;
|
||||
$args_nopwd[] = '-P=' . $this->port;
|
||||
}
|
||||
if ($this->base) {
|
||||
$args[] = '-b=' . $this->base;
|
||||
$args_nopwd[] = '-b=' . $this->base;
|
||||
}
|
||||
if ($this->user) {
|
||||
$args[] = '-u=' . $this->user;
|
||||
$args_nopwd[] = '-u=' . $this->user;
|
||||
}
|
||||
if ($this->password) {
|
||||
$args[] = '-p=' . $this->password;
|
||||
$args_nopwd[] = '-p=******';
|
||||
}
|
||||
if ($this->socket) {
|
||||
$args[] = '--socket=' . $this->socket;
|
||||
$args_nopwd[] = '--socket=' . $this->socket;
|
||||
}
|
||||
if ($this->use_sbas) {
|
||||
$args[] = '-o';
|
||||
$args_nopwd[] = '-o';
|
||||
}
|
||||
if ($this->charset) {
|
||||
$args[] = '--default-character-set=' . $this->charset;
|
||||
$args_nopwd[] = '--default-character-set=' . $this->charset;
|
||||
}
|
||||
if ($this->debugmask > 0) {
|
||||
$args[] = '-d=' . $this->debugmask;
|
||||
$args_nopwd[] = '-d=' . $this->debugmask;
|
||||
}
|
||||
if ($this->nolog) {
|
||||
$args[] = '-n';
|
||||
$args_nopwd[] = '-n';
|
||||
}
|
||||
if ($this->winsvc_run) {
|
||||
$args[] = '--run';
|
||||
$args_nopwd[] = '--run';
|
||||
}
|
||||
|
||||
$registry = registry::get_instance();
|
||||
$logdir = p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
|
||||
|
||||
$this->new_status = NULL; // new status to set at the end
|
||||
$this->exception = NULL; // exception to throw at the end
|
||||
|
||||
$this->log(sprintf("running cindexer with method %s", $this->method));
|
||||
switch ($this->method) {
|
||||
case self::METHOD_PROC_OPEN:
|
||||
$this->run_with_proc_open($cmd, $args, $args_nopwd);
|
||||
break;
|
||||
case self::METHOD_FORK:
|
||||
$this->run_with_fork($cmd, $args, $args_nopwd);
|
||||
break;
|
||||
case self::METHOD_EXEC:
|
||||
$this->run_with_exec($cmd, $args, $args_nopwd);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($this->new_status !== NULL) {
|
||||
$this->setState($this->new_status);
|
||||
}
|
||||
|
||||
if ($this->exception) {
|
||||
throw $this->exception;
|
||||
}
|
||||
}
|
||||
|
||||
private function run_with_proc_open($cmd, $args, $args_nopwd)
|
||||
{
|
||||
$nullfile = defined('PHP_WINDOWS_VERSION_BUILD') ? 'NUL' : '/dev/null';
|
||||
|
||||
$descriptors = array();
|
||||
$descriptors[1] = array("file", $nullfile, "a+");
|
||||
$descriptors[2] = array("file", $nullfile, "a+");
|
||||
|
||||
$pipes = array();
|
||||
|
||||
$this->log(sprintf('cmd=\'%s %s\'', $cmd, implode(' ', $args_nopwd)));
|
||||
|
||||
$process = proc_open($cmd . ' ' . implode(' ', $args), $descriptors, $pipes, $this->binpath, null, array('bypass_shell' => true));
|
||||
|
||||
$pid = NULL;
|
||||
if (is_resource($process)) {
|
||||
$proc_status = proc_get_status($process);
|
||||
if ($proc_status['running']) {
|
||||
$pid = $proc_status['pid'];
|
||||
}
|
||||
}
|
||||
$qsent = '';
|
||||
$timetokill = NULL;
|
||||
$sock = NULL;
|
||||
|
||||
$this->running = true;
|
||||
|
||||
while ($this->running) {
|
||||
if ($this->getState() == self::STATE_TOSTOP && $this->socket > 0) {
|
||||
// must quit task, so send 'Q' to port 127.0.0.1:XXXX to cindexer
|
||||
if ( ! $qsent && (($sock = socket_create(AF_INET, SOCK_STREAM, 0)) !== false)) {
|
||||
if (socket_connect($sock, '127.0.0.1', $this->socket) === true) {
|
||||
socket_write($sock, 'Q', 1);
|
||||
socket_write($sock, "\r\n", strlen("\r\n"));
|
||||
for ($i = 0; $this->running && $i < 5; $i ++ ) {
|
||||
sleep(1);
|
||||
}
|
||||
$qsent = 'Q';
|
||||
$timetokill = time() + 10;
|
||||
} else {
|
||||
socket_close($sock);
|
||||
$sock = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$proc_status = proc_get_status($process);
|
||||
if ( ! $proc_status['running']) {
|
||||
// the cindexer died
|
||||
if ($qsent == 'Q') {
|
||||
$this->log(_('task::cindexer:the cindexer clean-quit'));
|
||||
$this->new_status = self::STATE_STOPPED;
|
||||
} elseif ($qsent == 'K') {
|
||||
$this->log(_('task::cindexer:the cindexer has been killed'));
|
||||
$this->new_status = self::STATE_STOPPED;
|
||||
} else {
|
||||
$this->log(_('task::cindexer:the cindexer crashed'));
|
||||
$this->exception = new Exception('cindexer crashed', self::ERR_CRASHED);
|
||||
// do not change the status so scheduler may restart it
|
||||
}
|
||||
$this->running = false;
|
||||
} else {
|
||||
// the cindexer is still alive
|
||||
if ($qsent == 'Q') {
|
||||
if (time() > $timetokill) {
|
||||
// must kill cindexer
|
||||
$this->log(_('task::cindexer:killing the cindexer'));
|
||||
$qsent = 'K';
|
||||
proc_terminate($process); // sigint
|
||||
}
|
||||
}
|
||||
}
|
||||
for ($i = 0; $this->running && $i < 5; $i ++ ) {
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
if ($sock) {
|
||||
socket_close($sock);
|
||||
$sock = NULL;
|
||||
}
|
||||
|
||||
foreach (array_keys($pipes) as $offset) {
|
||||
if (is_resource($pipes[$offset])) {
|
||||
fclose($pipes[$offset]);
|
||||
}
|
||||
}
|
||||
|
||||
proc_terminate($process); // sigint
|
||||
proc_close($process);
|
||||
}
|
||||
|
||||
private function run_with_fork($cmd, $args, $args_nopwd)
|
||||
{
|
||||
$pid = pcntl_fork();
|
||||
if ($pid == -1) {
|
||||
$this->exception = new Exception('cindexer can\'t fork', self::ERR_CANT_FORK);
|
||||
} elseif ($pid == 0) {
|
||||
// child
|
||||
umask(0);
|
||||
if (($err = posix_setsid()) < 0) {
|
||||
$this->exception = new Exception('cindexer can\'t detach from terminal', $err);
|
||||
} else {
|
||||
chdir(dirname(__FILE__));
|
||||
pcntl_exec($cmd, $args);
|
||||
sleep(2);
|
||||
}
|
||||
} else {
|
||||
// parent
|
||||
$this->running = true;
|
||||
|
||||
$sigsent = NULL;
|
||||
while ($this->running) {
|
||||
// is the cindexer alive ?
|
||||
if ( ! posix_kill($pid, 0)) {
|
||||
// dead...
|
||||
if ($sigsent === NULL) {
|
||||
// but it's not my fault
|
||||
$this->log(_('task::cindexer:the cindexer crashed'));
|
||||
$this->exception = new Exception('cindexer crashed', self::ERR_CRASHED);
|
||||
// do not change the status so scheduler may restart it
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->getState() == self::STATE_TOSTOP) {
|
||||
posix_kill($pid, ($sigsent = SIGINT));
|
||||
$timetokill = time() + 10;
|
||||
sleep(2);
|
||||
}
|
||||
|
||||
$status = NULL;
|
||||
if (pcntl_wait($status, WNOHANG) == $pid) {
|
||||
// child (indexer) has exited
|
||||
if ($sigsent == SIGINT) {
|
||||
$this->log(_('task::cindexer:the cindexer clean-quit'));
|
||||
$this->new_status = self::STATE_STOPPED;
|
||||
} elseif ($sigsent == SIGKILL) {
|
||||
$this->log(_('task::cindexer:the cindexer has been killed'));
|
||||
$this->new_status = self::STATE_STOPPED;
|
||||
} else {
|
||||
$this->log(_('task::cindexer:the cindexer crashed'));
|
||||
$this->exception = new Exception('cindexer crashed', self::ERR_CRASHED);
|
||||
// do not change the status so scheduler may restart it
|
||||
}
|
||||
$this->running = false;
|
||||
} else {
|
||||
if ($sigsent == SIGINT && time() > $timetokill) {
|
||||
// must kill cindexer
|
||||
$this->log(_('task::cindexer:killing the cindexer'));
|
||||
posix_kill($pid, ($sigsent = SIGKILL));
|
||||
}
|
||||
sleep(2);
|
||||
}
|
||||
} // while running
|
||||
}
|
||||
}
|
||||
|
||||
private function run_with_exec($cmd, $args, $args_nopwd)
|
||||
{
|
||||
pcntl_exec($cmd, $args);
|
||||
sleep(2);
|
||||
}
|
||||
}
|
@@ -247,7 +247,7 @@ class task_period_outofdate extends task_abstract
|
||||
data["taskid"] = <?php echo $this->getID(); ?>;
|
||||
data["ACT"] = "CALCSQL";
|
||||
data["cls"]="outofdate";
|
||||
$.ajax({ url: "/admin/taskfacility.php"
|
||||
$.ajax({ url: "/admin/task-manager/task/<?php echo $this->getID(); ?>/facility/"
|
||||
, data: data
|
||||
, dataType:'json'
|
||||
, type:"POST"
|
||||
@@ -272,7 +272,7 @@ class task_period_outofdate extends task_abstract
|
||||
var data = {taskid:<?php echo $this->getID(); ?>, bid: sbaspopup.value};
|
||||
data["ACT"] = "GETBASE";
|
||||
data["cls"]="outofdate";
|
||||
$.ajax({ url: "/admin/taskfacility.php"
|
||||
$.ajax({ url: "/admin/task-manager/task/<?php echo $this->getID(); ?>/facility/"
|
||||
, data: data
|
||||
, dataType:'json'
|
||||
, type:"POST"
|
||||
|
@@ -228,7 +228,7 @@ class task_period_workflow01 extends task_databoxAbstract
|
||||
}
|
||||
if (sbaspopup.value > 0) {
|
||||
$.ajax({
|
||||
url:"/admin/taskfacility.php"
|
||||
url:"/admin/task-manager/task/<?php echo $this->getID(); ?>/facility/"
|
||||
, async:false
|
||||
, data:{'cls':'workflow01', 'taskid':<?php echo $this->getID() ?>, 'bid':sbaspopup.value}
|
||||
, success:function(data){
|
||||
|
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="iddivloading" style="background-image:url('./trans.gif');background-position: top bottom; background-repeat: repeat; border:#ff0000 3px solid;position:absolute; width:94%;height:80%; top:95px; left:10px;z-index:99;text-align:center">
|
||||
<div id="iddivloading" style="border:#ff0000 3px solid;position:absolute; width:94%;height:80%; top:95px; left:10px;z-index:99;text-align:center">
|
||||
<table style='width:100%;height:100%; text-align:center;vertical-align: middle; color:#FF0000; font-size:16px'>
|
||||
<tr>
|
||||
<td>
|
||||
@@ -39,7 +39,6 @@
|
||||
</div>
|
||||
|
||||
<span id="spanref" style="position:absolute; bottom:0px; left:5px; background-color:#0f00cc; visibility:hidden">
|
||||
<img src="./pixel.gif" name="test_longueur" width="1" height="100%" align="left">
|
||||
</span>
|
||||
|
||||
<div id="divref" > </div>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{% extends "common/index_bootstrap.html.twig" %}
|
||||
|
||||
{% block icon %}
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/admin/favicon.ico">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/skins/admin/favicon.ico">
|
||||
{% endblock %}
|
||||
|
||||
{% block rss %}
|
||||
|
@@ -51,7 +51,7 @@
|
||||
|
||||
<!-- _____________ xml interface _____________ -->
|
||||
<div id="taskXmlTab">
|
||||
<form action="./task2utils.php" onsubmit="return(false);" name="fxml" method="post">
|
||||
<form onsubmit="return(false);" name="fxml" method="post">
|
||||
<textarea nowrap id="txtareaxml" style="white-space:pre; width:100%; height:250px" name="txtareaxml" >{{task.getSettings()}}</textarea>
|
||||
</form>
|
||||
</div>
|
||||
|
@@ -228,7 +228,6 @@
|
||||
switch(action)
|
||||
{
|
||||
case "schedulerStart":
|
||||
// $.get("./runscheduler.php", "", function() {});
|
||||
$.ajax({
|
||||
url: "/admin/task-manager/scheduler/start",
|
||||
type:"GET",
|
||||
|
@@ -66,7 +66,7 @@
|
||||
<li class="{% if feature == 'taskmanager' %}selected{% endif %}">
|
||||
<a target="right" href="/admin/task-manager/tasks/" class="ajax">
|
||||
<img src="/skins/admin/TaskManager.png" />
|
||||
{% trans 'admin::utilisateurs: gestionnaire de taches' %}
|
||||
<span>{% trans 'admin::utilisateurs: gestionnaire de taches' %}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
@@ -2,21 +2,15 @@
|
||||
|
||||
require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.class.inc';
|
||||
|
||||
/**
|
||||
* Test class for TaskManager.
|
||||
* Generated by PHPUnit on 2012-09-11 at 18:42:29.
|
||||
*/
|
||||
class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract {
|
||||
|
||||
/**
|
||||
* @var TaskManager
|
||||
*/
|
||||
|
||||
protected $client;
|
||||
protected $app;
|
||||
|
||||
public function createApplication()
|
||||
{
|
||||
public function createApplication() {
|
||||
$this->app = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Admin.php';
|
||||
|
||||
$this->app['debug'] = true;
|
||||
@@ -25,69 +19,33 @@ class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
return $this->app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->client = $this->createClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers {className}::{origMethodName}
|
||||
* @todo Implement testConnect().
|
||||
*/
|
||||
|
||||
public function testRouteTaskManager()
|
||||
{
|
||||
public function testRouteTaskManager() {
|
||||
/**
|
||||
* get /admin/task-manager/ should redirect to /admin/task-manager/tasks
|
||||
*/
|
||||
$this->client->request(
|
||||
'GET',
|
||||
'/task-manager/',
|
||||
array()
|
||||
);
|
||||
'GET', '/task-manager/', array()
|
||||
);
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect('/admin/task-manager/tasks/'));
|
||||
}
|
||||
|
||||
|
||||
public function testRouteTaskManager_tasks()
|
||||
{
|
||||
public function testRouteTaskManager_tasks() {
|
||||
$task_manager = new \task_manager($this->app['phraseanet.appbox']);
|
||||
|
||||
/**
|
||||
* get /admin/task-manager/tasks/ should return html by default
|
||||
*/
|
||||
$crawler = $this->client->request(
|
||||
'GET',
|
||||
'/task-manager/tasks/',
|
||||
array()
|
||||
);
|
||||
'GET', '/task-manager/tasks/', array()
|
||||
);
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$this->assertCount(1, $crawler->filter('form#taskManagerForm'));
|
||||
|
||||
/**
|
||||
* get /admin/task-manager/tasks/ can also return json
|
||||
*/
|
||||
$crawler = $this->client->request(
|
||||
'GET',
|
||||
'/task-manager/tasks/',
|
||||
array(),
|
||||
array(),
|
||||
array('CONTENT_TYPE' => 'application/json')
|
||||
);
|
||||
'GET', '/task-manager/tasks/', array(), array(), array('CONTENT_TYPE' => 'application/json')
|
||||
);
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$this->assertTrue($this->client->getResponse()->headers->contains('Content-Type', 'application/json'));
|
||||
|
||||
@@ -97,65 +55,45 @@ class TaskManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertEquals(count($task_manager->getTasks()), count(get_object_vars($json->tasks)));
|
||||
}
|
||||
|
||||
public function testRouteTaskManager_task_create()
|
||||
{
|
||||
public function testRouteTaskManager_task_create() {
|
||||
$task_manager = new \task_manager($this->app['phraseanet.appbox']);
|
||||
|
||||
$nTasks0 = count($task_manager->getTasks());
|
||||
|
||||
$this->client->request(
|
||||
'POST',
|
||||
'/task-manager/tasks/create/',
|
||||
array('tcl'=>'task_period_test')
|
||||
);
|
||||
'POST', '/task-manager/tasks/create/', array('tcl' => 'task_period_test')
|
||||
);
|
||||
|
||||
$nTasks1 = count($task_manager->getTasks(true)); // true: force refresh
|
||||
$this->assertEquals($nTasks1, $nTasks0+1);
|
||||
$this->assertEquals($nTasks1, $nTasks0 + 1);
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
|
||||
$location = $this->client->getResponse()->headers->get('location');
|
||||
$tid = array_pop(explode('/',$location));
|
||||
$tid = array_pop(explode('/', $location));
|
||||
|
||||
$this->client->request(
|
||||
'GET',
|
||||
'/task-manager/task/'.$tid.'/log',
|
||||
array()
|
||||
);
|
||||
'GET', '/task-manager/task/' . $tid . '/log', array()
|
||||
);
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
|
||||
$this->client->request(
|
||||
'GET',
|
||||
'/task-manager/task/'.$tid.'/delete',
|
||||
array()
|
||||
);
|
||||
'GET', '/task-manager/task/' . $tid . '/delete', array()
|
||||
);
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect('/admin/task-manager/tasks/'));
|
||||
// $this->client->followRedirect();
|
||||
// $this->assertTrue($this->client->getResponse()->isOk());
|
||||
$nTasks2 = count($task_manager->getTasks(true)); // true: force refresh
|
||||
$this->assertEquals($nTasks2, $nTasks0);
|
||||
|
||||
}
|
||||
|
||||
public function testRouteTaskManager_scheduler_log()
|
||||
{
|
||||
public function testRouteTaskManager_scheduler_log() {
|
||||
$task_manager = new \task_manager($this->app['phraseanet.appbox']);
|
||||
|
||||
/**
|
||||
* get /admin/task-manager/scheduler/log should return html by default
|
||||
*/
|
||||
$this->client->request(
|
||||
'GET',
|
||||
'/task-manager/scheduler/log',
|
||||
array()
|
||||
);
|
||||
// $this->expectOutputString('');
|
||||
// var_dump($this->client->getResponse());
|
||||
'GET', '/task-manager/scheduler/log', array()
|
||||
);
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -6,27 +6,7 @@
|
||||
RewriteRule ^(mail-export)/([a-zA-Z0-9]*)\/?$ /include/download_anonymous.php?type=$1&token=$2 [L]
|
||||
RewriteRule ^(mail-export)/([a-zA-Z0-9]*)\/get$ /include/download_anonymous.php?type=$1&token=$2&get=1 [L]
|
||||
|
||||
RewriteRule ^admin/$ /admin/router.php [L]
|
||||
RewriteRule ^admin/databox/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/sphinx/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/structure/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/collection/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/statusbit/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/dashboard/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/databoxes/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/setup/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/description/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/connected-users/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/users/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/tests/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/fields/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/publications/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/typeahead/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/subdefs/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/tasks/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/task/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/task-manager/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin/scheduler/.*$ /admin/router.php [L]
|
||||
RewriteRule ^admin.?$ /admin/router.php [L]
|
||||
|
||||
RewriteRule ^prod/records/edit/.*$ /prod/router.php [L]
|
||||
RewriteRule ^prod/records/movecollection/.*$ /prod/router.php [L]
|
||||
|
@@ -1,155 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
/* @var $Core \Alchemy\Phrasea\Core */
|
||||
$Core = require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||
$appbox = appbox::get_instance($Core);
|
||||
|
||||
$request = http_request::getInstance();
|
||||
$registry = $appbox->get_registry();
|
||||
$parm = $request->get_parms('action', 'position', 'test', 'renew', 'path', 'tests');
|
||||
|
||||
$output = '';
|
||||
|
||||
switch ($parm['action']) {
|
||||
case 'APACHE':
|
||||
if ($parm['test'] == 'success') {
|
||||
$output = '1';
|
||||
} else {
|
||||
$output = '0';
|
||||
}
|
||||
break;
|
||||
case 'SCHEDULERKEY':
|
||||
$output = $registry->get('GV_ServerName') . 'admin/runscheduler.php?key=' . urlencode(phrasea::scheduler_key( ! ! $parm['renew']));
|
||||
break;
|
||||
|
||||
case 'SETTASKSTATUS':
|
||||
$parm = $request->get_parms('task_id', 'status', 'signal');
|
||||
try {
|
||||
$task_manager = new task_manager($appbox);
|
||||
$task = $task_manager->getTask($parm['task_id']);
|
||||
$pid = (int) ($task->getPID());
|
||||
$task->setState($parm["status"]);
|
||||
$signal = (int) ($parm['signal']);
|
||||
if ($signal > 0 && $pid) {
|
||||
posix_kill($pid, $signal);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
$output = json_encode($pid);
|
||||
break;
|
||||
|
||||
case 'SETSCHEDSTATUS':
|
||||
$parm = $request->get_parms('status', 'signal');
|
||||
try {
|
||||
$task_manager = new task_manager($appbox);
|
||||
|
||||
$task_manager->setSchedulerState($parm['status']);
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case 'RESETTASKCRASHCOUNTER':
|
||||
$parm = $request->get_parms("task_id");
|
||||
try {
|
||||
$task_manager = new task_manager($appbox);
|
||||
$task = $task_manager->getTask($parm['task_id']);
|
||||
$task->resetCrashCounter();
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
$ret = new DOMDocument("1.0", "UTF-8");
|
||||
$ret->standalone = true;
|
||||
$ret->preserveWhiteSpace = false;
|
||||
$root = $ret->appendChild($ret->createElement("result"));
|
||||
$root->appendChild($ret->createCDATASection(var_export($parm, true)));
|
||||
|
||||
$output = $ret->saveXML();
|
||||
break;
|
||||
*/
|
||||
case 'CHANGETASK':
|
||||
$parm = $request->get_parms('act', 'task_id', "usr");
|
||||
$ret = new DOMDocument("1.0", "UTF-8");
|
||||
$ret->standalone = true;
|
||||
$ret->preserveWhiteSpace = false;
|
||||
$root = $ret->appendChild($ret->createElement("result"));
|
||||
$root->setAttribute("saved", "0");
|
||||
$root->appendChild($ret->createCDATASection(var_export($parm, true)));
|
||||
|
||||
try {
|
||||
$task_manager = new task_manager($appbox);
|
||||
$task = $task_manager->getTask($parm["task_id"]);
|
||||
/**
|
||||
* @todo checker, cette methode n'est pas implementee partout
|
||||
*/
|
||||
$root->setAttribute("crashed", $task->getCrashCounter());
|
||||
if ($task->saveChanges($conn, $parm["task_id"], $row)) {
|
||||
$root->setAttribute("saved", "1");
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
$output = $ret->saveXML();
|
||||
break;
|
||||
/*
|
||||
case 'PINGSCHEDULER_JS':
|
||||
$parm = $request->get_parms('dbps');
|
||||
$ret = array('time' => date("H:i:s"));
|
||||
|
||||
$task_manager = new task_manager($appbox);
|
||||
$ret['scheduler'] = $task_manager->getSchedulerState();
|
||||
|
||||
$ret['tasks'] = array();
|
||||
|
||||
foreach ($task_manager->getTasks(true) as $task) {
|
||||
if ($task->getState() == task_abstract::STATE_TOSTOP && $task->getPID() === NULL) {
|
||||
// fix
|
||||
$task->setState(task_abstract::STATE_STOPPED);
|
||||
}
|
||||
$id = $task->getID();
|
||||
$ret['tasks'][$id] = array(
|
||||
'id' => $id
|
||||
, 'pid' => $task->getPID()
|
||||
, 'crashed' => $task->getCrashCounter()
|
||||
, 'completed' => $task->getCompletedPercentage()
|
||||
, 'status' => $task->getState()
|
||||
);
|
||||
}
|
||||
|
||||
if ($parm['dbps']) {
|
||||
$sql = 'SHOW PROCESSLIST';
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$rows = $stmt->fetchALL(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
$ret['db_processlist'] = array();
|
||||
foreach ($rows as $row) {
|
||||
if ($row['Info'] != $sql) {
|
||||
$ret['db_processlist'][] = $row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$output = p4string::jsonencode($ret);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
unset($appbox);
|
||||
echo $output;
|
@@ -1,194 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
define("FORMAT_REEL", 1); // #,##0.00
|
||||
define("FORMAT_ENTIER", 2); // #,##0
|
||||
define("FORMAT_TEXTE", 3); // @
|
||||
|
||||
class fileSYLK
|
||||
{
|
||||
var $myhandler = null;
|
||||
var $fileName = null;
|
||||
var $fieldsToExport = null;
|
||||
var $cfg_formats = null;
|
||||
var $nblines = null;
|
||||
var $nbrows = null;
|
||||
var $row_format = null;
|
||||
var $format = null;
|
||||
|
||||
function fileSYLK()
|
||||
{
|
||||
$this->cfg_formats[FORMAT_ENTIER] = "FF0";
|
||||
$this->cfg_formats[FORMAT_REEL] = "FF2";
|
||||
$this->cfg_formats[FORMAT_TEXTE] = "FG0";
|
||||
}
|
||||
|
||||
function setfilename($aFileName)
|
||||
{
|
||||
|
||||
$registry = registry::get_instance();
|
||||
$pathtmp = $registry->get('GV_RootPath') . 'tmp/';
|
||||
$this->fileName = $pathtmp . $aFileName;
|
||||
}
|
||||
|
||||
function setFieldsNamesList($arrayFields)
|
||||
{
|
||||
//$this->fieldsToExport = $arrayFields;
|
||||
foreach ($arrayFields as $idx => $a) {
|
||||
$this->fieldsToExport[$idx] = $arrayFields[$idx]['name'];
|
||||
|
||||
if (isset($arrayFields[$idx]['format'])) {
|
||||
switch ($arrayFields[$idx]['format']) {
|
||||
case "integer":
|
||||
$this->row_format[$idx] = FORMAT_ENTIER;
|
||||
$this->format[$idx] = $this->cfg_formats[$this->row_format[$idx]] . "R";
|
||||
break;
|
||||
|
||||
case "double":
|
||||
$this->row_format[$idx] = FORMAT_REEL;
|
||||
$this->format[$idx] = $this->cfg_formats[$this->row_format[$idx]] . "R";
|
||||
break;
|
||||
|
||||
default:
|
||||
$this->row_format[$idx] = FORMAT_TEXTE;
|
||||
$this->format[$idx] = $this->cfg_formats[$this->row_format[$idx]] . "L";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$this->row_format[$idx] = FORMAT_TEXTE;
|
||||
$this->format[$idx] = $this->cfg_formats[$this->row_format[$idx]] . "L";
|
||||
}
|
||||
}
|
||||
|
||||
$this->nbrows = count($this->fieldsToExport);
|
||||
}
|
||||
|
||||
function setNbLines($nb)
|
||||
{
|
||||
$this->nblines = $nb;
|
||||
}
|
||||
|
||||
function openHandler()
|
||||
{
|
||||
if ($this->fileName)
|
||||
$this->myhandler = @fopen($this->fileName, 'a');
|
||||
}
|
||||
|
||||
function releaseHandler()
|
||||
{
|
||||
if ($this->myhandler)
|
||||
fclose($this->myhandler);
|
||||
}
|
||||
|
||||
function release()
|
||||
{
|
||||
$this->releaseHandler();
|
||||
}
|
||||
|
||||
function writeHeader()
|
||||
{
|
||||
if ( ! $this->myhandler)
|
||||
$this->openHandler();
|
||||
if ($this->myhandler) {
|
||||
// fwrite($this->myhandler, $somecontent);
|
||||
|
||||
fwrite($this->myhandler, "ID;APhraseanet\n"); // ID;Pappli
|
||||
fwrite($this->myhandler, "\n");
|
||||
// formats
|
||||
fwrite($this->myhandler, "P;PGeneral\n");
|
||||
fwrite($this->myhandler, "P;P#,##0.00\n"); // P;Pformat_1 (reels)
|
||||
fwrite($this->myhandler, "P;P#,##0\n"); // P;Pformat_2 (entiers)
|
||||
fwrite($this->myhandler, "P;P@\n"); // P;Pformat_3 (textes)
|
||||
fwrite($this->myhandler, "\n");
|
||||
// polices
|
||||
fwrite($this->myhandler, "P;EArial;M200\n");
|
||||
fwrite($this->myhandler, "P;EArial;M200\n");
|
||||
fwrite($this->myhandler, "P;EArial;M200\n");
|
||||
fwrite($this->myhandler, "P;FArial;M200;SB\n");
|
||||
fwrite($this->myhandler, "\n");
|
||||
|
||||
|
||||
fwrite($this->myhandler, "B;Y" . ($this->nblines + 1)); ## <?php echo == NB de lignes qu'il y aura avec +1 pour les titres de colone en gras
|
||||
fwrite($this->myhandler, ";X" . $this->nbrows . "\n"); ## <?php echo == NB de colones qu'il y aura
|
||||
fwrite($this->myhandler, "\n");
|
||||
|
||||
/*
|
||||
// largeurs des colonnes
|
||||
// pour chaque colones, on calcul la largeur
|
||||
// dans cette classe on defini ttes las col de la meme tailles
|
||||
for ($cpt = 1; $cpt <= $nbcol; $cpt++)
|
||||
{
|
||||
for($t=0;$t < count($tableau);$t++)
|
||||
$tmpo[$t]= strlen($tableau[$t][$cpt-1]);
|
||||
$taille=max($tmpo);
|
||||
// F;Wcoldeb colfin largeur
|
||||
if (strlen($tableau[0][$cpt-1]) > $taille)
|
||||
$taille=strlen($tableau[0][$cpt-1]);
|
||||
if ($taille>50)
|
||||
$taille=50;
|
||||
print( "F;W".$cpt." ".$cpt." ".$taille."\n");
|
||||
}
|
||||
*/
|
||||
$taille = 25;
|
||||
for ($cmpt = 0; $cmpt < $this->nbrows; $cmpt ++ )
|
||||
fwrite($this->myhandler, "F;W" . ($cmpt + 1) . " " . ($cmpt + 1) . " " . $taille . "\n");
|
||||
|
||||
fwrite($this->myhandler, "F;W" . $this->nbrows . " 256 8\n"); // F;Wcoldeb colfin largeur
|
||||
fwrite($this->myhandler, "\n");
|
||||
|
||||
|
||||
|
||||
// on ecris l'en-tete des colonnes (en gras --> SDM4)
|
||||
for ($cmpt = 1; $cmpt <= $this->nbrows; $cmpt ++ ) {
|
||||
fwrite($this->myhandler, "F;SDM4;FG0C;" . ($cmpt == 1 ? "Y1;" : "") . "X" . $cmpt . "\n");
|
||||
fwrite($this->myhandler, "C;N;K\"" . $this->fieldsToExport[$cmpt - 1] . "\"\n");
|
||||
}
|
||||
fwrite($this->myhandler, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
function addLine($lineNum, $arrayFields)
|
||||
{
|
||||
if ( ! $this->myhandler)
|
||||
$this->openHandler();
|
||||
if ($this->myhandler) {
|
||||
// fwrite($this->myhandler, $somecontent);
|
||||
// parcours des champs par colone
|
||||
for ($cmpt = 0; $cmpt < $this->nbrows; $cmpt ++ ) {
|
||||
|
||||
if ( ! isset($arrayFields[$cmpt]))
|
||||
$arrayFields[$cmpt] = '';
|
||||
$arrayFields[$cmpt] = str_replace("\n", "\x1B\x20\x3A", $arrayFields[$cmpt]);
|
||||
// format
|
||||
fwrite($this->myhandler, "F;P" . $this->row_format[$cmpt] . ";" . $this->format[$cmpt]);
|
||||
fwrite($this->myhandler, ($cmpt == 0 ? ";Y" . $lineNum : "") . ";X" . ($cmpt + 1) . "\n");
|
||||
// valeur
|
||||
if ($this->row_format[$cmpt] == FORMAT_TEXTE)
|
||||
fwrite($this->myhandler, "C;N;K\"" . str_replace(';', ';;', $arrayFields[$cmpt]) . "\"\n");
|
||||
else
|
||||
fwrite($this->myhandler, "C;N;K" . $arrayFields[$cmpt] . "\n");
|
||||
}
|
||||
fwrite($this->myhandler, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
function writeEnd()
|
||||
{
|
||||
fwrite($this->myhandler, "E\n");
|
||||
$this->releaseHandler();
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 43 B |
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
/* @var $Core \Alchemy\Phrasea\Core */
|
||||
$Core = require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||
$appbox = appbox::get_instance($Core);
|
||||
$session = $appbox->get_session();
|
||||
$registry = $appbox->get_registry();
|
||||
$request = http_request::getInstance();
|
||||
$parm = $request->get_parms('key');
|
||||
|
||||
$scheduler_key = phrasea::scheduler_key();
|
||||
|
||||
$good_user = false;
|
||||
if ($session->is_authenticated()) {
|
||||
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
||||
if ($user->ACL()->has_right('taskmanager'))
|
||||
$good_user = true;
|
||||
}
|
||||
|
||||
if ( ! $good_user && (trim($scheduler_key) == '' || $scheduler_key !== $parm['key'])) {
|
||||
phrasea::headers(403);
|
||||
}
|
||||
|
||||
set_time_limit(0);
|
||||
session_write_close();
|
||||
ignore_user_abort(true);
|
||||
|
||||
$nullfile = '/dev/null';
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$nullfile = 'NUL';
|
||||
}
|
||||
|
||||
$phpcli = $registry->get('GV_cli');
|
||||
|
||||
$cmd = $phpcli . ' -f ' . $registry->get('GV_RootPath') . "bin/console scheduler:start";
|
||||
|
||||
|
||||
$descriptors[1] = array("file", $nullfile, "a+");
|
||||
$descriptors[2] = array("file", $nullfile, "a+");
|
||||
|
||||
$pipes = null;
|
||||
$cwd = $registry->get('GV_RootPath') . "bin/";
|
||||
$proc = proc_open($cmd, $descriptors, $pipes, $cwd, null, array('bypass_shell' => true));
|
||||
|
||||
$pid = NULL;
|
||||
if (is_resource($proc)) {
|
||||
$proc_status = proc_get_status($proc);
|
||||
if ($proc_status['running'])
|
||||
$pid = $proc_status['pid'];
|
||||
}
|
||||
if ($pid !== NULL) {
|
||||
$msg = sprintf("scheduler '%s' started (pid=%s)", $cmd, $pid);
|
||||
my_syslog(LOG_INFO, $msg);
|
||||
} else {
|
||||
@fclose($pipes[1]);
|
||||
@fclose($pipes[2]);
|
||||
@proc_close($process);
|
||||
|
||||
$msg = sprintf("scheduler '%s' failed to start", $cmd);
|
||||
my_syslog(LOG_INFO, $msg);
|
||||
}
|
||||
|
||||
function my_syslog($level, $msg)
|
||||
{
|
||||
print($msg . "\n");
|
||||
}
|
@@ -1,91 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
/* @var $Core \Alchemy\Phrasea\Core */
|
||||
$Core = require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||
$appbox = appbox::get_instance($Core);
|
||||
$session = $appbox->get_session();
|
||||
|
||||
$request = http_request::getInstance();
|
||||
$parm = $request->get_parms('fil', 'id', 'clr');
|
||||
?>
|
||||
<html lang="<?php echo($session->get_I18n()); ?>">
|
||||
<head>
|
||||
<style>
|
||||
* {font-family: monospace}
|
||||
BODY {margin: 0px; padding: 0px}
|
||||
H1 { font-size: 18px; background-color:#CCCCCC; padding: 0px}
|
||||
A { padding: 3px; color: #000000 }
|
||||
A.current {background-color: #ffffff}
|
||||
PRE {padding-left: 3px; padding-right: 3px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
$registry = $appbox->get_registry();
|
||||
$logdir = p4string::addEndSlash($registry->get('GV_RootPath') . 'logs');
|
||||
|
||||
$name = str_replace('..', '', $parm['fil']);
|
||||
|
||||
$rname = $name;
|
||||
if ($parm['id']) {
|
||||
$rname .= '_' . $parm['id'];
|
||||
}
|
||||
$rname = '/' . $rname . '((\.log)|(-.*\.log))$/';
|
||||
|
||||
$finder = new Finder();
|
||||
$finder
|
||||
->files()->name($rname)
|
||||
->in($logdir)
|
||||
->date('> now - 1 days')
|
||||
->sortByModifiedTime()
|
||||
->sort(function($a, $b) {
|
||||
return -1;
|
||||
});
|
||||
|
||||
$found = false;
|
||||
foreach ($finder->getIterator() as $file) {
|
||||
if ($parm['clr'] == $file->getFilename()) {
|
||||
file_put_contents($file->getRealPath(), '');
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
if ($found) {
|
||||
return phrasea::redirect(sprintf("/admin/showlogtask.php?fil=%s&id=%s"
|
||||
, urlencode($parm['fil'])
|
||||
, urlencode($parm['id']))
|
||||
);
|
||||
}
|
||||
|
||||
$found = false;
|
||||
foreach ($finder->getIterator() as $file) { {
|
||||
printf("<h4>%s\n", $file->getRealPath());
|
||||
printf(" <a href=\"/admin/showlogtask.php?fil=%s&id=%s&clr=" . urlencode($file->getFilename()) . "\">" . _('Clear') . "</a>"
|
||||
, urlencode($parm['fil'])
|
||||
, urlencode($parm['id']));
|
||||
print("</h4>\n<pre>\n");
|
||||
print(htmlentities(file_get_contents($file->getRealPath())));
|
||||
print("</pre>\n");
|
||||
}
|
||||
$found = true;
|
||||
}
|
||||
if ( ! $found) {
|
||||
printf("<h4>file <b>%s</b> does not exists</h4>\n", $logdir . $name);
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
@@ -1,128 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||
|
||||
$request = http_request::getInstance();
|
||||
$parm = $request->get_parms('tid' // task_id
|
||||
);
|
||||
?>
|
||||
var allgetID = new Array ;
|
||||
var total = 0;
|
||||
var statuscoll="";
|
||||
var changeInXml = false ;
|
||||
var avantModif="";
|
||||
|
||||
function loadXMLDoc(url, post_parms, asxml)
|
||||
{
|
||||
if(typeof(asxml)=="undefined")
|
||||
asxml = false;
|
||||
out = null;
|
||||
xmlhttp = null;
|
||||
// code for Mozilla, etc.
|
||||
if (window.XMLHttpRequest)
|
||||
xmlhttp=new XMLHttpRequest();
|
||||
else if (window.ActiveXObject)
|
||||
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
||||
|
||||
if (xmlhttp)
|
||||
{
|
||||
// xmlhttp.onreadystatechange=state_Change
|
||||
if(post_parms)
|
||||
{
|
||||
xmlhttp.open("POST", url, false);
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
|
||||
xmlhttp.send(post_parms);
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlhttp.open("GET", url, false);
|
||||
xmlhttp.send(null);
|
||||
}
|
||||
out = asxml ? xmlhttp.responseXML : xmlhttp.responseText;
|
||||
}
|
||||
|
||||
return(out);
|
||||
}
|
||||
|
||||
|
||||
var pass=false;
|
||||
/*
|
||||
function redrawme()
|
||||
{
|
||||
hauteur = document.body.clientHeight;
|
||||
// document.getElementById("idBox2").style.height = (hauteur-140)+"px"; // div interface graph
|
||||
// document.getElementById("txtareaxml").style.height = (hauteur-170)+"px"; // textarea interface xml
|
||||
document.getElementById("idBox2").style.height = (hauteur-130)+"px"; // div interface graph
|
||||
document.getElementById("txtareaxml").style.height = (hauteur-160)+"px"; // textarea interface xml
|
||||
}
|
||||
*/
|
||||
|
||||
var pref = new Array(0);
|
||||
var lastpref=null;
|
||||
|
||||
|
||||
function chgName(name)
|
||||
{
|
||||
url = "/admin/adminFeedback.php?action=CHANGETASK";
|
||||
parms = "task_id=<?php echo $parm['tid'] ?>";
|
||||
parms += "&name=" + encodeURIComponent(name);
|
||||
// alert(url+"?"+parms);
|
||||
ret = loadXMLDoc(url, parms, true);
|
||||
}
|
||||
|
||||
function chgActive(ck)
|
||||
{
|
||||
url = "/admin/adminFeedback.php?action=CHANGETASK";
|
||||
parms = "task_id=<?php echo $parm['tid'] ?>";
|
||||
parms += "&active=" + (ck ? "1":"0");
|
||||
// alert(url+"?"+parms);
|
||||
if( (ret = loadXMLDoc(url, parms, true)) )
|
||||
{
|
||||
crashed = ret.documentElement.getAttribute("crashed");
|
||||
document.getElementById("idCrashCount").innerHTML = crashed;
|
||||
document.getElementById("idCrashLine").style.visibility = crashed > 0 ? "visible" : "hidden";
|
||||
// if(ret.documentElement.getAttribute("saved") == "1")
|
||||
// return(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function saveXML()
|
||||
{
|
||||
var xml = document.forms["fxml"].txtareaxml.value;
|
||||
if(xml)
|
||||
{
|
||||
url = "/admin/adminFeedback.php?action=CHANGETASK";
|
||||
parms += "?task_id=<?php echo $parm['tid'] ?>";
|
||||
parms += "&xml=" + encodeURIComponent(xml);
|
||||
// alert(url+"?"+parms);
|
||||
if( (ret = loadXMLDoc(url, parms, true)) )
|
||||
{
|
||||
if(ret.documentElement.getAttribute("saved") == "1")
|
||||
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function returnToTaskList()
|
||||
{
|
||||
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
/* @var $Core \Alchemy\Phrasea\Core */
|
||||
$Core = require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||
$appbox = appbox::get_instance($Core);
|
||||
|
||||
$request = http_request::getInstance();
|
||||
$parm = $request->get_parms('act' // NEWTASK or SAVETASK
|
||||
, "tid"
|
||||
, 'tcl' // task class
|
||||
, 'view' // XML ou GRAPHIC
|
||||
);
|
||||
|
||||
$lng = Session_Handler::get_locale();
|
||||
$task_manager = new task_manager($appbox);
|
||||
|
||||
phrasea::headers();
|
||||
|
||||
if ( ! $parm['view'])
|
||||
$parm['view'] = 'GRAPHIC';
|
||||
|
||||
|
||||
$refreshfinder = false;
|
||||
$out = "";
|
||||
|
||||
try {
|
||||
switch ($parm['act']) {
|
||||
case 'NEWTASK': // blank task from scratch, NOT saved into sql
|
||||
$task = task_abstract::create($appbox, $parm['tcl']);
|
||||
break;
|
||||
case 'EDITTASK': // existing task
|
||||
$task = $task_manager->getTask($parm['tid']);
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Unknown action');
|
||||
break;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
phrasea::headers(404);
|
||||
}
|
||||
|
||||
$zGraphicForm = 'graphicForm';
|
||||
$hasGraphicMode = false;
|
||||
|
||||
if ($task->hasInterfaceHTML()) {
|
||||
$hasGraphicMode = true;
|
||||
} else {
|
||||
$parm['view'] = 'XML';
|
||||
}
|
||||
|
||||
function stripdoublequotes($value)
|
||||
{
|
||||
return str_replace(array("\r\n", "\r", "\n", "\""), array('', '', '', '\"'), $value);
|
||||
}
|
||||
$parm['view'] = 'XML';
|
||||
|
||||
$core = \bootstrap::getCore();
|
||||
$twig = $core->getTwig();
|
||||
|
||||
$parm['view'] = 'XML';
|
||||
|
||||
echo $twig->render('admin/task.html.twig', array('task' => $task, 'view' => $parm['view']));
|
@@ -1,142 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
/* @var $Core \Alchemy\Phrasea\Core */
|
||||
$Core = require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||
$appbox = appbox::get_instance($Core);
|
||||
$session = $appbox->get_session();
|
||||
|
||||
$request = http_request::getInstance();
|
||||
$parm = $request->get_parms(
|
||||
'__act'
|
||||
, '__class' // task class
|
||||
, '__tname'
|
||||
, '__tactive'
|
||||
, '__xml'
|
||||
, '__tid'
|
||||
, 'txtareaxml'
|
||||
);
|
||||
|
||||
phrasea::headers();
|
||||
?>
|
||||
<html lang="<?php echo $session->get_I18n(); ?>">
|
||||
<head>
|
||||
<link type="text/css" rel="stylesheet" href="/include/minify/f=skins/common/main.css,skins/admin/admincolor.css" />
|
||||
<?php
|
||||
$task_manager = new task_manager($appbox);
|
||||
$ztask = $task_manager->getTask($parm['__tid']);
|
||||
switch ($parm['__act']) {
|
||||
case 'FORM2XML':
|
||||
if ($ztask->hasInterfaceHTML()) {
|
||||
$xml = p4string::MakeString($ztask->graphic2xml($parm['__xml']), "js");
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var d = parent.document;
|
||||
|
||||
parent.jsTaskObj.oldXML = d.getElementById('txtareaxml').value = "<?php echo $xml ?>";
|
||||
d.getElementById('divGraph').style.display = "none";
|
||||
d.getElementById('divXml').style.display = "";
|
||||
d.getElementById('linkviewxml').className = "tabFront";
|
||||
d.getElementById('linkviewgraph').className = "tabBack";
|
||||
parent.jsTaskObj.currentView = "XML";
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
break;
|
||||
|
||||
case 'XML2FORM':
|
||||
if ($ztask->hasInterfaceHTML()) {
|
||||
if ((simplexml_load_string($parm['txtareaxml']))) {
|
||||
if (($msg = ($ztask->xml2graphic($parm['txtareaxml'], "parent.document.forms['graphicForm']"))) == "") {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var d = parent.document;
|
||||
d.getElementById('divGraph').style.display = "";
|
||||
d.getElementById('divXml').style.display = "none";
|
||||
d.getElementById('linkviewxml').className = "tabBack";
|
||||
d.getElementById('linkviewgraph').className = "tabFront";
|
||||
parent.jsTaskObj.currentView = "GRAPHIC";
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
alert("<?php echo p4string::MakeString($msg, 'js', '"') ?>");
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
if(confirm("<?php echo p4string::MakeString(_('admin::tasks: xml invalide, restaurer la version precedente ?'), 'js', '"') // xml invalide, restaurer la v. prec. ? ?>"))
|
||||
{
|
||||
parent.document.forms['fxml'].txtareaxml.value = parent.jsTaskObj.oldXML;
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'SAVE_GRAPHIC':
|
||||
$parm['txtareaxml'] = $ztask->graphic2xml($parm['__xml']);
|
||||
|
||||
case 'SAVE_XML':
|
||||
if ((simplexml_load_string($parm['txtareaxml']))) {
|
||||
if (method_exists($ztask, 'checkXML')) {
|
||||
if ($ztask->checkXML($parm['txtareaxml']) != '') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$task_manager = new task_manager($appbox);
|
||||
$tid = $parm['__tid'];
|
||||
$task = $task_manager->getTask($tid);
|
||||
|
||||
$task->setActive($parm['__tactive']);
|
||||
$task->setTitle($parm['__tname']);
|
||||
$task->setSettings($parm['txtareaxml']);
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
parent.document.getElementById("taskid").innerHTML = "id : <?php echo $tid ?>";
|
||||
if(o=parent.document.getElementById("__gtid"))
|
||||
o.value = "<?php echo $tid ?>";
|
||||
parent.document.forms['fxml'].__tid.value = "<?php echo $tid ?>";
|
||||
// parent.document.getElementById("saveButtons").style.display = "none";
|
||||
// parent.document.getElementById("returnButton").style.display = "";
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
if(confirm("<?php echo p4string::MakeString(_('admin::tasks: xml invalide, restaurer la version precedente ?'), 'js', '"') ?>"))
|
||||
parent.document.forms['fxml'].txtareaxml.value = parent.jsTaskObj.oldXML;
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
break;
|
||||
|
||||
case 'CANCEL_GRAPHIC':
|
||||
break;
|
||||
|
||||
case 'CANCEL_XML':
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
$Core = require_once dirname(dirname(__DIR__)) . "/lib/bootstrap.php";
|
||||
|
||||
$request = http_request::getInstance();
|
||||
$parm = $request->get_parms('cls', 'taskid');
|
||||
|
||||
$cls = 'task_period_' . $parm['cls'];
|
||||
|
||||
$ztask = new $cls($parm['taskid'], $Core['monolog']);
|
||||
|
||||
echo $ztask->facility();
|
@@ -1,598 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2012 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
/* @var $Core \Alchemy\Phrasea\Core */
|
||||
$Core = require_once __DIR__ . "/../../lib/bootstrap.php";
|
||||
$appbox = appbox::get_instance($Core);
|
||||
$session = $appbox->get_session();
|
||||
|
||||
$request = http_request::getInstance();
|
||||
$parm = $request->get_parms("act", "tid");
|
||||
|
||||
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
||||
|
||||
if ( ! $user->ACL()->has_right('taskmanager')) {
|
||||
phrasea::headers(403);
|
||||
}
|
||||
|
||||
phrasea::headers();
|
||||
$registry = $appbox->get_registry();
|
||||
|
||||
$task_manager = new task_manager($appbox);
|
||||
|
||||
$refresh_tasklist = false;
|
||||
if ($parm["act"] == "DELETETASK") {
|
||||
try {
|
||||
$task = $task_manager->getTask($parm['tid']);
|
||||
$task->delete();
|
||||
$refresh_tasklist = true;
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
<html lang="<?php echo $session->get_I18n(); ?>">
|
||||
<head>
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="/include/minify/f=skins/common/main.css,skins/admin/admincolor.css" />
|
||||
<link rel="stylesheet" href="/include/minify/f=include/jslibs/jquery.contextmenu.css,include/jslibs/jquery-ui-1.8.17/css/ui-lightness/jquery-ui-1.8.17.custom.css" type="text/css" media="screen" />
|
||||
<style>
|
||||
.divTop
|
||||
{
|
||||
OVERFLOW: hidden;
|
||||
height:18px;
|
||||
}
|
||||
#redbox0 table{
|
||||
font-size:10px;
|
||||
text-align:center;
|
||||
table-layout: fixed;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/include/minify/f=include/jslibs/jquery.contextmenu.css,include/jslibs/jquery-ui-1.8.17/css/ui-lightness/jquery-ui-1.8.17.custom.css" type="text/css" media="screen" />
|
||||
<script type="text/javascript" src="/include/minify/f=include/jslibs/jquery-1.7.1.js,include/jslibs/jquery-ui-1.8.17/jquery-ui-i18n.js,include/jslibs/jquery.contextmenu.js"></script>
|
||||
<script type="text/javascript" src="/include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var retPing = null;
|
||||
|
||||
var newTaskMenu = null;
|
||||
|
||||
var allgetID = new Array ;
|
||||
var total = 0;
|
||||
|
||||
|
||||
function resized()
|
||||
{
|
||||
$("#redbox0").width($("#tableau_center").width()-4);
|
||||
$("#redbox1").width = ($("#tableau_center").width()-4);
|
||||
}
|
||||
|
||||
function newTask(tclass)
|
||||
{
|
||||
document.forms["task"].target = "";
|
||||
document.forms["task"].act.value = "NEWTASK";
|
||||
document.forms["task"].tcl.value = tclass;
|
||||
document.forms["task"].submit();
|
||||
}
|
||||
|
||||
function doMenuSched(act)
|
||||
{
|
||||
switch(act)
|
||||
{
|
||||
case "start":
|
||||
lauchScheduler();
|
||||
break;
|
||||
case "stop":
|
||||
setSchedStatus('tostop');
|
||||
break;
|
||||
case "log":
|
||||
window.open("/admin/showlogtask.php?fil=scheduler&log=l", "scheduler.log");
|
||||
break;
|
||||
case "preferences":
|
||||
preferencesScheduler();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function doMenuTask(context, act)
|
||||
{
|
||||
var tid = $(context).parent().attr('id').split('_').pop();
|
||||
|
||||
switch(act)
|
||||
{
|
||||
case "edit":
|
||||
editTask(tid);
|
||||
break;
|
||||
case "start":
|
||||
setTaskStatus(tid, 'tostart', null, true); // null:no signal, true : reset crash counter
|
||||
break;
|
||||
case "stop":
|
||||
setTaskStatus(tid, 'tostop', 15, false); // 15 = SIGTERM
|
||||
break;
|
||||
case 'delete':
|
||||
if(confirm("<?php echo p4string::MakeString(_('admin::tasks: supprimer la tache ?'), 'js', '"') ?>"))
|
||||
{
|
||||
document.forms["taskManager"].target = "";
|
||||
document.forms["taskManager"].act.value = "DELETETASK";
|
||||
document.forms["taskManager"].tid.value = tid;
|
||||
document.forms["taskManager"].submit();
|
||||
}
|
||||
break;
|
||||
case "log":
|
||||
window.open("/admin/showlogtask.php?fil=task&id="+tid+"&log=l", "task_"+tid+".log");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function preferencesScheduler()
|
||||
{
|
||||
var buttons = {
|
||||
'<?php echo _('Fermer') ?>':function(){$('#scheduler-preferences').dialog('close').dialog('destroy')},
|
||||
'<?php echo _('Renouveller') ?>':function(){renew_scheduler_key();}
|
||||
};
|
||||
$('#scheduler-preferences').dialog({
|
||||
width:400,
|
||||
height:200,
|
||||
modal:true,
|
||||
resizable:false,
|
||||
draggable:false,
|
||||
buttons:buttons
|
||||
});
|
||||
}
|
||||
|
||||
function renew_scheduler_key()
|
||||
{
|
||||
var datas = {action:'SCHEDULERKEY', renew:'1'};
|
||||
$.post("/admin/adminFeedback.php"
|
||||
, datas
|
||||
, function(data){
|
||||
$('#scheduler_key').val(data);
|
||||
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
resized();
|
||||
|
||||
$(this).bind('resize',function(){resized();});
|
||||
|
||||
var allgetID = new Array ;
|
||||
var total = 0;
|
||||
|
||||
|
||||
var menuNewTask = [
|
||||
<?php
|
||||
// fill the 'new task' menu
|
||||
$tasks = task_manager::getAvailableTasks();
|
||||
$ntasks = count($tasks);
|
||||
foreach ($tasks as $t) {
|
||||
printf(" {\n");
|
||||
printf(" '%s':\n", p4string::MakeString($t["name"], 'js'));
|
||||
printf(" {\n");
|
||||
printf(" disabled:%s,\n", $t["err"] ? 'true' : 'false');
|
||||
printf(" onclick:function(menuItem, menu) { newTask('%s'); },\n", p4string::MakeString($t["class"], 'js'));
|
||||
printf(" title:'%s'\n", p4string::MakeString($t["name"], 'js'));
|
||||
printf(" }\n");
|
||||
printf(" }%s\n", -- $ntasks ? ',' : '');
|
||||
}
|
||||
?>
|
||||
];
|
||||
|
||||
$('#newTaskButton').contextMenu(
|
||||
menuNewTask,
|
||||
{
|
||||
// theme:'vista'
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
$('.dropdown.scheduler').contextMenu(
|
||||
[
|
||||
{
|
||||
'Start':
|
||||
{
|
||||
onclick:function(menuItem,menu) { doMenuSched('start'); },
|
||||
title:'Demarrer le TaskManager'
|
||||
}
|
||||
},
|
||||
{
|
||||
'Stop':
|
||||
{
|
||||
onclick:function(menuItem,menu) { doMenuSched('stop'); },
|
||||
title:'Arreter le TaskManager'
|
||||
}
|
||||
},
|
||||
$.contextMenu.separator,
|
||||
{
|
||||
'Show log':
|
||||
{
|
||||
onclick:function(menuItem,menu) { doMenuSched('log'); },
|
||||
title:'Afficher les logs'
|
||||
}
|
||||
},
|
||||
{
|
||||
'Preferences':
|
||||
{
|
||||
onclick:function(menuItem,menu) { doMenuSched('preferences'); },
|
||||
title:'Scheduler preferences'
|
||||
}
|
||||
}
|
||||
]
|
||||
,
|
||||
{
|
||||
// theme:'vista',
|
||||
optionsIdx:{'start':0, 'stop':1},
|
||||
beforeShow:function()
|
||||
{
|
||||
if(!retPing)
|
||||
return;
|
||||
if(retPing.scheduler && retPing.scheduler.pid)
|
||||
{
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['stop']+')').removeClass("context-menu-item-disabled");
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['start']+')').addClass("context-menu-item-disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['stop']+')').addClass("context-menu-item-disabled");
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['start']+')').removeClass("context-menu-item-disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$('.task_manager .dropdown.task').contextMenu(
|
||||
[
|
||||
{
|
||||
'Edit':
|
||||
{
|
||||
onclick:function(menuItem,menu) { doMenuTask($(this), 'edit'); },
|
||||
title:'Modifier cette tache'
|
||||
}
|
||||
},
|
||||
{
|
||||
'Start':
|
||||
{
|
||||
onclick:function(menuItem,menu) { doMenuTask($(this), 'start'); },
|
||||
title:'Demarrer cette tache'
|
||||
}
|
||||
},
|
||||
{
|
||||
'Stop':
|
||||
{
|
||||
onclick:function(menuItem,menu) { doMenuTask($(this), 'stop'); },
|
||||
title:'Arreter cette tache'
|
||||
}
|
||||
},
|
||||
{
|
||||
'Delete':
|
||||
{
|
||||
onclick:function(menuItem,menu) { doMenuTask($(this), 'delete'); },
|
||||
title:'Supprimer cette tache'
|
||||
}
|
||||
},
|
||||
$.contextMenu.separator,
|
||||
{
|
||||
'Show log':
|
||||
{
|
||||
onclick:function(menuItem,menu) { doMenuTask($(this), 'log'); },
|
||||
title:'Afficher les logs'
|
||||
}
|
||||
}
|
||||
],
|
||||
{
|
||||
optionsIdx:{'edit':0, 'start':1, 'stop':2, 'delete':3, 'log':5},
|
||||
beforeShow:function()
|
||||
{
|
||||
var tid = $($(this)[0].target).parent().attr('id').split('_').pop();
|
||||
|
||||
if(!retPing || !retPing.tasks[tid])
|
||||
return;
|
||||
|
||||
if(retPing.tasks[tid].pid)
|
||||
{
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['edit']+')').addClass("context-menu-item-disabled");
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['stop']+')').removeClass("context-menu-item-disabled");
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['start']+')').addClass("context-menu-item-disabled");
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['delete']+')').addClass("context-menu-item-disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['edit']+')').removeClass("context-menu-item-disabled");
|
||||
|
||||
if(retPing.tasks[tid].status == 'started' || retPing.tasks[tid].status == 'torestart')
|
||||
{
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['stop']+')').removeClass("context-menu-item-disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['stop']+')').addClass("context-menu-item-disabled");
|
||||
}
|
||||
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['delete']+')').removeClass("context-menu-item-disabled");
|
||||
|
||||
if(retPing.scheduler && retPing.scheduler.pid && !(retPing.tasks[tid].status == 'started' || retPing.tasks[tid].status == 'torestart'))
|
||||
{
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['start']+')').removeClass("context-menu-item-disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this.menu).find('.context-menu-item:eq('+this.optionsIdx['start']+')').addClass("context-menu-item-disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
self.setTimeout("pingScheduler(true);", 100); // true : loop forever each 2 sec
|
||||
}
|
||||
)
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iframe id="zsched" src="about:blank" style="position:absolute; top:0px; left:0px; width:50px; height:50px; visibility:hidden"></iframe>
|
||||
|
||||
<h1><?php echo _('admin::tasks: planificateur de taches') ?>
|
||||
<span style="font-size:12px;">
|
||||
<?php echo sprintf(_('Last update at %s.'), '<span id="pingTime"></span>'); ?>
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
<table class="admintable task_manager" cellpadding="0" cellSpacing="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:20px;"></th>
|
||||
<th style="text-align:center; width:40px;">ID</th>
|
||||
<th style="text-align:center; width:30px;">!</th>
|
||||
<th style="text-align:center; width:80px;"><?php echo _('admin::tasks: statut de la tache') ?></th>
|
||||
<th style="text-align:center; width:60px;"><?php echo _('admin::tasks: process_id de la tache') ?></th>
|
||||
<th style="text-align:center; width:120px;"><?php echo _('admin::tasks: etat de progression de la tache') ?></th>
|
||||
<th style="width:auto;"><?php echo _('admin::tasks: nom de la tache') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr id="TR_SCHED" class="sched even">
|
||||
<td class="dropdown scheduler">
|
||||
<img src="/skins/admin/dropdown.png"/>
|
||||
</td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
<td style="text-align:center" id="STATUS_SCHED"></td>
|
||||
<td id="PID_SCHED" style="text-align:center;"> </td>
|
||||
<td> </td>
|
||||
<td style="font-weight:900" class="taskname">TaskManager</td>
|
||||
</tr>
|
||||
<?php
|
||||
$n = 0;
|
||||
foreach ($task_manager->getTasks($refresh_tasklist) as $task) {
|
||||
$n ++;
|
||||
$tid = $task->getID()
|
||||
?>
|
||||
<tr id="TR_<?php echo $tid ?>" class="task <?php echo $n % 2 == 0 ? 'even' : 'odd' ?>">
|
||||
<td class="dropdown task">
|
||||
<img src="/skins/admin/dropdown.png"/>
|
||||
</td>
|
||||
<td style="text-align:center; font-weight:900"><?php echo $tid ?></td>
|
||||
<td style="text-align:center"><img id="WARNING_<?php echo $tid ?>" src="/skins/icons/alert.png" title="" style="display:none;"/></td>
|
||||
<td style="text-align:center" id="STATUS_<?php echo $tid ?>"></td>
|
||||
<td style="text-align:center" id="PID_<?php echo $tid ?>"> </td>
|
||||
<td>
|
||||
<div style="position:relative; top:0px; left:0px; right:0px;" >
|
||||
<div id="COMPBOX_<?php echo $tid ?>" style="position:absolute; top:1px; left:3px; right:3px; height:5px; background-color:#787878">
|
||||
<div id="COMP_<?php echo $tid ?>" style="position:absolute; top:1px; left:0px; width:0%; height:3px; background-color:#FFFF80">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="taskname"><?php echo p4string::MakeString($task->getTitle()) ?> [<?php echo p4string::MakeString($task::getName()) ?>]</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="dropdown scheduler">
|
||||
<img id="newTaskButton" src="/skins/admin/dropdown.png"/>
|
||||
</td>
|
||||
<td colspan="6">
|
||||
<?php echo _('admin::tasks: Nouvelle tache') ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<div id="db_processlist"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
function editTask(tid)
|
||||
{
|
||||
document.forms["task"].target = "";
|
||||
document.forms["task"].act.value = "EDITTASK";
|
||||
document.forms["task"].tid.value = tid;
|
||||
document.forms["task"].submit();
|
||||
}
|
||||
|
||||
function setTaskStatus(tid, status, signal, resetCrashCounter)
|
||||
{
|
||||
if(resetCrashCounter)
|
||||
{
|
||||
$.ajax({
|
||||
url: "/admin/adminFeedback.php",
|
||||
data : { task_id:tid, action:"RESETTASKCRASHCOUNTER" },
|
||||
dataType:'xml',
|
||||
success: function(ret)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/admin/adminFeedback.php",
|
||||
data : {task_id:tid, action:"SETTASKSTATUS", status:status, signal:signal},
|
||||
dataType:'json',
|
||||
success: function(ret)
|
||||
{
|
||||
pingScheduler(false); // false : just one time
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function setSchedStatus(status)
|
||||
{
|
||||
$.ajax({
|
||||
url: "/admin/adminFeedback.php",
|
||||
data : { action:"SETSCHEDSTATUS", status:status },
|
||||
dataType:'json',
|
||||
success: function(ret)
|
||||
{
|
||||
pingScheduler(false); // false : just one time
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function deleteTask(tid)
|
||||
{
|
||||
if(confirm("<?php echo p4string::MakeString(_('admin::tasks: supprimer la tache ?'), 'js', '"') ?>"))
|
||||
{
|
||||
document.forms["taskManager"].target = "";
|
||||
document.forms["taskManager"].act.value = "DELETETASK";
|
||||
document.forms["taskManager"].tid.value = tid;
|
||||
document.forms["taskManager"].submit();
|
||||
}
|
||||
}
|
||||
|
||||
function pingScheduler(repeat)
|
||||
{
|
||||
$.ajax({
|
||||
url: '/admin/adminFeedback.php',
|
||||
data:{action:'PINGSCHEDULER_JS', dbps:0},
|
||||
dataType:'json',
|
||||
success: function(ret)
|
||||
{
|
||||
retPing = ret; // global
|
||||
if(ret.time)
|
||||
$("#pingTime").empty().append(ret.time);
|
||||
if(ret.scheduler)
|
||||
{
|
||||
if(ret.scheduler.status)
|
||||
$("#STATUS_SCHED").html(ret.scheduler.status);
|
||||
else
|
||||
$("#STATUS_SCHED").html('');
|
||||
if(ret.scheduler.pid)
|
||||
$("#PID_SCHED").html(ret.scheduler.pid);
|
||||
else
|
||||
$("#PID_SCHED").html('-');
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#STATUS_SCHED").html('');
|
||||
$("#PID_SCHED").html('-');
|
||||
}
|
||||
|
||||
if(ret.tasks)
|
||||
{
|
||||
for(id in ret.tasks)
|
||||
{
|
||||
if(ret.tasks[id].status)
|
||||
$("#STATUS_"+id).html(ret.tasks[id].status);
|
||||
else
|
||||
$("#STATUS_"+id).html('');
|
||||
|
||||
if(ret.tasks[id].pid)
|
||||
$("#PID_"+id).html(ret.tasks[id].pid);
|
||||
else
|
||||
$("#PID_"+id).html('-');
|
||||
|
||||
if(ret.tasks[id].crashed)
|
||||
{
|
||||
// $("#WARNING_"+id).show().setAttribute("src", "/skins/icons/alert.png");
|
||||
$("#WARNING_"+id).show().attr("title", "crashed "+ret.tasks[id].crashed+" times");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#WARNING_"+id).hide();
|
||||
}
|
||||
|
||||
if(ret.tasks[id].completed && ret.tasks[id].completed>0 && ret.tasks[id].completed<=100)
|
||||
{
|
||||
$("#COMP_"+id).width(ret.tasks[id].completed + "%");
|
||||
$("#COMPBOX_"+id).show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#COMPBOX_"+id).hide();
|
||||
$("#COMP_"+id).width('0px');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ret.db_processlist)
|
||||
{
|
||||
var _table = document.createElement('table');
|
||||
_table.setAttribute('class', 'db_processlist');
|
||||
for(p in ret.db_processlist)
|
||||
{
|
||||
if(p==0)
|
||||
{
|
||||
var _tr = _table.appendChild(document.createElement('tr'));
|
||||
for(c in ret.db_processlist[p])
|
||||
_tr.appendChild(document.createElement('th')).appendChild(document.createTextNode(c));
|
||||
}
|
||||
var _tr = _table.appendChild(document.createElement('tr'));
|
||||
for(c in ret.db_processlist[p])
|
||||
_tr.appendChild(document.createElement('td')).appendChild(document.createTextNode(ret.db_processlist[p][c]));
|
||||
}
|
||||
$("#db_processlist").html(_table);
|
||||
}
|
||||
if(repeat)
|
||||
self.setTimeout("pingScheduler(true);", 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function lauchScheduler()
|
||||
{
|
||||
url = "./runscheduler.php";
|
||||
document.getElementById("zsched").src = url;
|
||||
self.setTimeout('document.getElementById("zsched").src="about:blank";', 2000);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div id="scheduler-preferences" style="display:none;" title="<?php echo _('Preferences du TaskManager'); ?>">
|
||||
<div style="margin:5px 0;"><span><?php echo _('Cette URL vous permet de controler le sheduler depuis un manager comme cron') ?></span></div>
|
||||
<div style="margin:5px 0;"><input id="scheduler_key" style="width:100%;" type="text" readonly="readonly" value="<?php echo $registry->get('GV_ServerName') ?>admin/runscheduler.php?key=<?php echo phrasea::scheduler_key(); ?>" /></div>
|
||||
</div>
|
||||
|
||||
<form method="post" name="taskManager" action="/admin/taskmanager.php" target="???" onsubmit="return(false);" >
|
||||
<input type="hidden" name="act" value="" />
|
||||
<input type="hidden" name="tid" value="" />
|
||||
<input type="hidden" name="att" value="" />
|
||||
</form>
|
||||
<form method="post" name="task" action="/admin/task2.php" target="???" onsubmit="return(false);">
|
||||
<input type="hidden" name="act" value="???" />
|
||||
<input type="hidden" name="tid" value="" />
|
||||
<input type="hidden" name="tcl" value="" />
|
||||
<input type="hidden" name="view" value="GRAPHIC" />
|
||||
</form>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Before Width: | Height: | Size: 46 B |
@@ -28,8 +28,8 @@ $groups = array(
|
||||
, '//include/jslibs/jquery-treeview/jquery.treeview.js'
|
||||
, '//include/jslibs/jquery-ui-1.8.17/jquery-ui-i18n.js'
|
||||
, '//include/jquery.kb-event.js'
|
||||
, '//admin/users.js'
|
||||
, '//admin/editusers.js'
|
||||
, '//skins/admin/users.js'
|
||||
, '//skins/admin/editusers.js'
|
||||
, '//include/jquery.common.js'
|
||||
, '//include/account/geonames.js'
|
||||
, '//include/jquery.tooltip.js'
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Reference in New Issue
Block a user