mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 23:43:12 +00:00
fixes for windows
This commit is contained in:
106
lib/classes/task/period/subdef.class.php
Normal file → Executable file
106
lib/classes/task/period/subdef.class.php
Normal file → Executable file
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of Phraseanet
|
* This file is part of Phraseanet
|
||||||
*
|
*
|
||||||
* (c) 2005-2012 Alchemy
|
* (c) 2005-2010 Alchemy
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
@@ -142,7 +142,6 @@ class task_period_subdef extends task_databoxAbstract
|
|||||||
<?php echo $form ?>.maxmegs.value = "<?php echo p4string::MakeString($sxml->maxmegs, "js", '"') ?>";
|
<?php echo $form ?>.maxmegs.value = "<?php echo p4string::MakeString($sxml->maxmegs, "js", '"') ?>";
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -236,6 +235,58 @@ class task_period_subdef extends task_databoxAbstract
|
|||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function retrieve_sbas_content(databox $databox)
|
||||||
|
{
|
||||||
|
$connbas = $databox->get_connection();
|
||||||
|
|
||||||
|
$sql = 'SELECT coll_id, record_id
|
||||||
|
FROM record
|
||||||
|
WHERE jeton & ' . JETON_MAKE_SUBDEF . ' > 0
|
||||||
|
AND parent_record_id = 0
|
||||||
|
ORDER BY record_id DESC LIMIT 0, 20';
|
||||||
|
|
||||||
|
$stmt = $connbas->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return $rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function process_one_content(databox $databox, Array $row)
|
||||||
|
{
|
||||||
|
$record_id = $row['record_id'];
|
||||||
|
$this->log(sprintf(
|
||||||
|
"Generate subdefs for : sbas_id %s / record %s "
|
||||||
|
, $this->sbas_id, $record_id));
|
||||||
|
$record = new record_adapter($this->sbas_id, $record_id);
|
||||||
|
|
||||||
|
$record->generate_subdefs($databox, null, $this->debug);
|
||||||
|
|
||||||
|
$this->recs_to_write[] = $record->get_record_id();
|
||||||
|
|
||||||
|
if (count($this->recs_to_write) >= $this->record_buffer_size) {
|
||||||
|
$this->flush_records_sbas();
|
||||||
|
}
|
||||||
|
unset($record);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function post_process_one_content(databox $databox, Array $row)
|
||||||
|
{
|
||||||
|
$connbas = $databox->get_connection();
|
||||||
|
$sql = 'UPDATE record
|
||||||
|
SET jeton=(jeton & ~' . JETON_MAKE_SUBDEF . '), moddate=NOW()
|
||||||
|
WHERE record_id=:record_id';
|
||||||
|
|
||||||
|
$stmt = $connbas->prepare($sql);
|
||||||
|
$stmt->execute(array(':record_id' => $row['record_id']));
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
protected function flush_records_sbas()
|
protected function flush_records_sbas()
|
||||||
{
|
{
|
||||||
$sql = implode(', ', $this->recs_to_write);
|
$sql = implode(', ', $this->recs_to_write);
|
||||||
@@ -263,57 +314,6 @@ class task_period_subdef extends task_databoxAbstract
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function retrieve_sbas_content(databox $databox)
|
|
||||||
{
|
|
||||||
$connbas = $databox->get_connection();
|
|
||||||
|
|
||||||
$sql = 'SELECT coll_id, record_id
|
|
||||||
FROM record
|
|
||||||
WHERE jeton & ' . JETON_MAKE_SUBDEF . ' > 0
|
|
||||||
AND parent_record_id = 0
|
|
||||||
ORDER BY record_id DESC LIMIT 0, 20';
|
|
||||||
|
|
||||||
$stmt = $connbas->prepare($sql);
|
|
||||||
$stmt->execute();
|
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
return $rs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process_one_content(databox $databox, Array $row)
|
|
||||||
{
|
|
||||||
$record_id = $row['record_id'];
|
|
||||||
$this->log(sprintf(
|
|
||||||
"Generate subdefs for : sbas_id %s / record %s "
|
|
||||||
, $this->sbas_id, $record_id));
|
|
||||||
$record = new record_adapter($this->sbas_id, $record_id);
|
|
||||||
|
|
||||||
$record->generate_subdefs($databox, null);
|
|
||||||
|
|
||||||
$this->recs_to_write[] = $record->get_record_id();
|
|
||||||
|
|
||||||
if (count($this->recs_to_write) >= $this->record_buffer_size) {
|
|
||||||
$this->flush_records_sbas();
|
|
||||||
}
|
|
||||||
unset($record);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function post_process_one_content(databox $databox, Array $row)
|
|
||||||
{
|
|
||||||
$connbas = $databox->get_connection();
|
|
||||||
$sql = 'UPDATE record
|
|
||||||
SET jeton=(jeton & ~' . JETON_MAKE_SUBDEF . '), moddate=NOW()
|
|
||||||
WHERE record_id=:record_id';
|
|
||||||
|
|
||||||
$stmt = $connbas->prepare($sql);
|
|
||||||
$stmt->execute(array(':record_id' => $row['record_id']));
|
|
||||||
$stmt->closeCursor();
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Reference in New Issue
Block a user