mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 22:13:13 +00:00
Remove dead code
This commit is contained in:
@@ -99,8 +99,6 @@ abstract class task_abstract
|
||||
*/
|
||||
protected $maxmegs;
|
||||
protected $runner;
|
||||
private $input;
|
||||
private $output;
|
||||
|
||||
/**
|
||||
* delay between two loops
|
||||
@@ -794,22 +792,6 @@ abstract class task_abstract
|
||||
}
|
||||
}
|
||||
|
||||
public function traceRam($msg = '')
|
||||
{
|
||||
static $lastt = null;
|
||||
$t = explode(' ', ($ut = microtime()));
|
||||
if ($lastt === null) {
|
||||
$lastt = $t;
|
||||
}
|
||||
$dt = ($t[0] - $lastt[0]) + ($t[1] - $lastt[1]);
|
||||
|
||||
$m = memory_get_usage() >> 10;
|
||||
$d = debug_backtrace(false);
|
||||
|
||||
$lastt = $t;
|
||||
$this->logger->addDebug(memory_get_usage() . " -- " . memory_get_usage(true));
|
||||
}
|
||||
|
||||
public function log($message, $level=self::LOG_INFO)
|
||||
{
|
||||
// nb : self::log_levels ARE standard log levels, ok with monolog
|
||||
@@ -875,17 +857,6 @@ abstract class task_abstract
|
||||
return $task;
|
||||
}
|
||||
|
||||
public function getUsage()
|
||||
{
|
||||
global $argc, $argv;
|
||||
$t = "usage: " . $argv[0] . " [options]\noptions:\n";
|
||||
foreach ($this->argt as $n => $v) {
|
||||
$t .= "\t" . $n . $v["usage"] . "\n";
|
||||
}
|
||||
|
||||
return $t;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return int id of the task
|
||||
|
@@ -46,7 +46,6 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
$dom->formatOutput = true;
|
||||
|
||||
if ($dom->loadXML($oldxml)) {
|
||||
$xmlchanged = false;
|
||||
foreach (array(
|
||||
'str:period'
|
||||
, 'boo:logsql'
|
||||
@@ -72,7 +71,6 @@ class task_period_RecordMover extends task_appboxAbstract
|
||||
$ns->appendChild($dom->createTextNode($pvalue ? '1' : '0'));
|
||||
break;
|
||||
}
|
||||
$xmlchanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -92,7 +92,6 @@ class task_period_archive extends task_abstract
|
||||
$dom->formatOutput = true;
|
||||
$dom->preserveWhiteSpace = false;
|
||||
if ($dom->loadXML($oldxml)) {
|
||||
$xmlchanged = false;
|
||||
foreach (array(
|
||||
'str:base_id'
|
||||
, 'str:hotfolder'
|
||||
@@ -125,7 +124,6 @@ class task_period_archive extends task_abstract
|
||||
$ns->appendChild($dom->createTextNode($pvalue ? '1' : '0'));
|
||||
break;
|
||||
}
|
||||
$xmlchanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +294,8 @@ class task_period_archive extends task_abstract
|
||||
{
|
||||
$this->debug = false;
|
||||
|
||||
$conn = $this->dependencyContainer['phraseanet.appbox']->get_connection();
|
||||
// test if connection is available
|
||||
$this->dependencyContainer['phraseanet.appbox']->get_connection();
|
||||
|
||||
$this->sxTaskSettings = simplexml_load_string($this->settings);
|
||||
|
||||
@@ -378,7 +377,7 @@ class task_period_archive extends task_abstract
|
||||
$loop = 0;
|
||||
while ($this->running) {
|
||||
try {
|
||||
$conn = connection::getPDOConnection($this->dependencyContainer);
|
||||
connection::getPDOConnection($this->dependencyContainer);
|
||||
} catch (Exception $e) {
|
||||
$this->log($e->getMessage());
|
||||
if ($this->getRunner() == self::RUNNER_SCHEDULER) {
|
||||
@@ -1184,7 +1183,7 @@ class task_period_archive extends task_abstract
|
||||
if ($n->getAttribute('isdir') == '1') {
|
||||
if ($n->getAttribute('grp')) {
|
||||
// a grp folder : special work
|
||||
$this->ArchiveGrp($dom, $n, $path, $path_archived, $path_error, $nodesToDel);
|
||||
$this->archiveGrp($dom, $n, $path, $path_archived, $path_error, $nodesToDel);
|
||||
} else {
|
||||
// ...normal subfolder : recurse
|
||||
$name = $n->getAttribute('name');
|
||||
@@ -1807,7 +1806,6 @@ class task_period_archive extends task_abstract
|
||||
}
|
||||
|
||||
$file = $node->getAttribute('name');
|
||||
$cid = $node->getAttribute('cid');
|
||||
$captionFileNode = null;
|
||||
|
||||
$rootpath = p4string::delEndSlash(trim((string) ($this->sxTaskSettings->hotfolder)));
|
||||
@@ -1857,8 +1855,6 @@ class task_period_archive extends task_abstract
|
||||
*/
|
||||
private function archiveFileAndCaption(\DOMDocument $dom, \DOMElement $node, \DOMElement $captionFileNode = null, $path, $path_archived, $path_error, $grp_rid, array &$nodesToDel)
|
||||
{
|
||||
$ret = false;
|
||||
|
||||
$file = $node->getAttribute('name');
|
||||
$cid = $node->getAttribute('cid');
|
||||
$captionFileName = $captionFileNode ? $captionFileNode->getAttribute('name') : null;
|
||||
@@ -1893,9 +1889,9 @@ class task_period_archive extends task_abstract
|
||||
$collection = collection::get_from_coll_id($this->dependencyContainer, $databox, (int) $cid);
|
||||
|
||||
if ($captionFileName === null) {
|
||||
$record = $this->createRecord($collection, $path . '/' . $file, null, $grp_rid);
|
||||
$this->createRecord($collection, $path . '/' . $file, null, $grp_rid);
|
||||
} else {
|
||||
$record = $this->createRecord($collection, $path . '/' . $file, $path . '/' . $captionFileName, $grp_rid);
|
||||
$this->createRecord($collection, $path . '/' . $file, $path . '/' . $captionFileName, $grp_rid);
|
||||
}
|
||||
|
||||
$node->setAttribute('archived', '1');
|
||||
@@ -1940,8 +1936,6 @@ class task_period_archive extends task_abstract
|
||||
$this->log($e->getMessage());
|
||||
}
|
||||
}
|
||||
if (!$node->getAttribute('keep')) // do not count copy of special files as a real event
|
||||
$ret = true;
|
||||
}
|
||||
|
||||
if ($node->getAttribute('error') && $this->move_error) {
|
||||
@@ -1968,10 +1962,6 @@ class task_period_archive extends task_abstract
|
||||
$this->log($e->getMessage());
|
||||
}
|
||||
}
|
||||
// do not count copy of special files as a real event
|
||||
if (!$node->getAttribute('keep')) {
|
||||
$ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$node->getAttribute('keep')) {
|
||||
|
@@ -128,7 +128,6 @@ class task_period_cindexer extends task_abstract
|
||||
$dom = new DOMDocument();
|
||||
$dom->formatOutput = true;
|
||||
if ($dom->loadXML($oldxml)) {
|
||||
$xmlchanged = false;
|
||||
foreach (array("str:host", "str:port", "str:base", "str:user", "str:password", "str:socket", "boo:nolog", "str:clng", "boo:winsvc_run", "str:charset", 'str:debugmask', 'str:stem', 'str:sortempty') as $pname) {
|
||||
$ptype = substr($pname, 0, 3);
|
||||
$pname = substr($pname, 4);
|
||||
@@ -151,7 +150,6 @@ class task_period_cindexer extends task_abstract
|
||||
$ns->appendChild($dom->createTextNode($pvalue ? '1' : '0'));
|
||||
break;
|
||||
}
|
||||
$xmlchanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,13 +387,8 @@ class task_period_cindexer extends task_abstract
|
||||
{
|
||||
$cmd = $this->getIndexer();
|
||||
|
||||
$nullfile = '/dev/null';
|
||||
$this->method = self::METHOD_PROC_OPEN;
|
||||
|
||||
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
|
||||
$nullfile = '/dev/null';
|
||||
}
|
||||
|
||||
if ( ! file_exists($cmd) || ! is_executable($cmd)) {
|
||||
$this->setState(self::STATE_STOPPED);
|
||||
$this->log(sprintf('File \'%s\' does not exists', $cmd));
|
||||
@@ -459,8 +452,6 @@ class task_period_cindexer extends task_abstract
|
||||
$args_nopwd[] = '--run';
|
||||
}
|
||||
|
||||
$logdir = $this->dependencyContainer['root.path'] . '/logs/';
|
||||
|
||||
$this->new_status = NULL; // new status to set at the end
|
||||
$this->exception = NULL; // exception to throw at the end
|
||||
|
||||
@@ -503,13 +494,6 @@ class task_period_cindexer extends task_abstract
|
||||
|
||||
$process = proc_open($execmd, $descriptors, $pipes, dirname($cmd), 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;
|
||||
|
@@ -52,7 +52,6 @@ class task_period_ftp extends task_appboxAbstract
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->formatOutput = true;
|
||||
if ((@$dom->loadXML($oldxml)) != FALSE) {
|
||||
$xmlchanged = false;
|
||||
foreach (array('str:proxy', 'str:proxyport', 'str:period', 'pop:syslog') as $pname) {
|
||||
$ptype = substr($pname, 0, 3);
|
||||
$pname = substr($pname, 4);
|
||||
@@ -76,7 +75,6 @@ class task_period_ftp extends task_appboxAbstract
|
||||
$ns->appendChild($dom->createTextNode($pvalue ? '1' : '0'));
|
||||
break;
|
||||
}
|
||||
$xmlchanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,15 +272,10 @@ class task_period_ftp extends task_appboxAbstract
|
||||
|
||||
protected function processOneContent(appbox $appbox, $export)
|
||||
{
|
||||
$conn = $appbox->get_connection();
|
||||
|
||||
$id = $export->getId();
|
||||
|
||||
$state = "";
|
||||
$ftp_server = $export->getAddr();
|
||||
$ftp_user_name = $export->getLogin();
|
||||
$ftp_user_pass = $export->getPwd();
|
||||
$usr_id = $export->getUsrId();
|
||||
|
||||
$ftpLog = $ftp_user_name . "@" . p4string::addEndSlash($ftp_server) . $export->getDestfolder();
|
||||
|
||||
@@ -498,8 +491,6 @@ class task_period_ftp extends task_appboxAbstract
|
||||
|
||||
public function finalize(appbox $appbox, FtpExport $export)
|
||||
{
|
||||
$conn = $appbox->get_connection();
|
||||
|
||||
if ($export->getCrash() >= $export->getNbretry()) {
|
||||
$this->send_mails($appbox, $export);
|
||||
|
||||
|
@@ -100,7 +100,6 @@ class task_period_ftpPull extends task_appboxAbstract
|
||||
|
||||
public function printInterfaceJS()
|
||||
{
|
||||
global $parm;
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -156,7 +155,6 @@ class task_period_ftpPull extends task_appboxAbstract
|
||||
|
||||
public function getInterfaceHTML()
|
||||
{
|
||||
global $parm;
|
||||
ob_start();
|
||||
?>
|
||||
<form name="graphicForm" onsubmit="return(false);" method="post">
|
||||
|
@@ -80,8 +80,6 @@ class task_period_subdef extends task_databoxAbstract
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->formatOutput = true;
|
||||
if (@$dom->loadXML($oldxml)) {
|
||||
$xmlchanged = false;
|
||||
|
||||
foreach (array('str:period', 'str:flush', 'str:maxrecs', 'str:maxmegs', 'boo:embedded') as $pname) {
|
||||
$ptype = substr($pname, 0, 3);
|
||||
$pname = substr($pname, 4);
|
||||
@@ -102,7 +100,6 @@ class task_period_subdef extends task_databoxAbstract
|
||||
$ns->appendChild($dom->createTextNode($pvalue ? '1' : '0'));
|
||||
break;
|
||||
}
|
||||
$xmlchanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -44,7 +44,6 @@ class task_period_writemeta extends task_databoxAbstract
|
||||
$dom->preserveWhiteSpace = false;
|
||||
$dom->formatOutput = true;
|
||||
if ($dom->loadXML($oldxml)) {
|
||||
$xmlchanged = false;
|
||||
foreach (array('str:period', 'str:maxrecs', 'str:maxmegs', 'boo:cleardoc') as $pname) {
|
||||
$ptype = substr($pname, 0, 3);
|
||||
$pname = substr($pname, 4);
|
||||
@@ -68,7 +67,6 @@ class task_period_writemeta extends task_databoxAbstract
|
||||
$ns->appendChild($dom->createTextNode($pvalue ? '1' : '0'));
|
||||
break;
|
||||
}
|
||||
$xmlchanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user