mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Merge branch 'master' into elastic-indexer
Conflicts: .gitignore
This commit is contained in:
@@ -17,9 +17,9 @@ class Setup_Upgrade
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var appbox
|
||||
* @var Applications
|
||||
*/
|
||||
private $appbox;
|
||||
private $app;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -30,16 +30,16 @@ class Setup_Upgrade
|
||||
public function __construct(Application $app, $force = false)
|
||||
{
|
||||
if ($force) {
|
||||
self::remove_lock_file();
|
||||
$this->remove_lock_file();
|
||||
}
|
||||
|
||||
if (self::lock_exists()) {
|
||||
if ($this->lock_exists()) {
|
||||
throw new Exception_Setup_UpgradeAlreadyStarted('The upgrade is already started');
|
||||
}
|
||||
|
||||
$this->appbox = $app['phraseanet.appbox'];
|
||||
$this->app = $app;
|
||||
|
||||
if (version_compare($this->appbox->get_version(), '3.9', '<')
|
||||
if (version_compare($this->app['phraseanet.appbox']->get_version(), '3.9', '<')
|
||||
&& count(MailChecker::getWrongEmailUsers($app)) > 0) {
|
||||
throw new \Exception_Setup_FixBadEmailAddresses('Please fix the database before starting');
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class Setup_Upgrade
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
self::remove_lock_file();
|
||||
$this->remove_lock_file();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -93,9 +93,9 @@ class Setup_Upgrade
|
||||
'last_update' => $date_obj->format(DATE_ATOM),
|
||||
], 1);
|
||||
|
||||
if (!file_put_contents(self::get_lock_file(), $datas))
|
||||
if (!file_put_contents($this->get_lock_file(), $datas))
|
||||
throw new Exception_Setup_CannotWriteLockFile(
|
||||
sprintf('Cannot write lock file to %s', self::get_lock_file())
|
||||
sprintf('Cannot write lock file to %s', $this->get_lock_file())
|
||||
);
|
||||
|
||||
return $this;
|
||||
@@ -106,11 +106,11 @@ class Setup_Upgrade
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private static function lock_exists()
|
||||
private function lock_exists()
|
||||
{
|
||||
clearstatcache();
|
||||
|
||||
return file_exists(self::get_lock_file());
|
||||
return file_exists($this->get_lock_file());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,19 +118,19 @@ class Setup_Upgrade
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function get_lock_file()
|
||||
private function get_lock_file()
|
||||
{
|
||||
return __DIR__ . '/../../../tmp/upgrade.lock';
|
||||
return $this->app['tmp.path'].'/locks/upgrade.lock';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Void
|
||||
*/
|
||||
private static function remove_lock_file()
|
||||
private function remove_lock_file()
|
||||
{
|
||||
if (self::lock_exists()) {
|
||||
unlink(self::get_lock_file());
|
||||
if ($this->lock_exists()) {
|
||||
unlink($this->get_lock_file());
|
||||
}
|
||||
|
||||
return;
|
||||
|
@@ -288,30 +288,33 @@ class appbox extends base
|
||||
$app['phraseanet.pre-schema-upgrader']->apply($app);
|
||||
|
||||
$finder = new Finder();
|
||||
$finder->in([
|
||||
$this->app['root.path'] . '/tmp/cache_minify/',
|
||||
$this->app['root.path'] . '/tmp/cache_twig/',
|
||||
$this->app['root.path'] . '/tmp/translations/',
|
||||
$this->app['root.path'] . '/tmp/cache/profiler/',
|
||||
$this->app['root.path'] . '/tmp/doctrine/',
|
||||
$this->app['root.path'] . '/tmp/serializer/',
|
||||
])
|
||||
$in = [];
|
||||
foreach ($app['cache.paths'] as $path) {
|
||||
$in[] = $path.'/minify/';
|
||||
$in[] = $path.'/twig/';
|
||||
$in[] = $path.'/translations/';
|
||||
$in[] = $path.'/profiler/';
|
||||
$in[] = $path.'/doctrine/';
|
||||
$in[] = $path.'/serializer/';
|
||||
};
|
||||
$finder->in(array_filter($in, function($path) {
|
||||
return is_dir($path);
|
||||
}))
|
||||
->depth(0)
|
||||
->ignoreVCS(true)
|
||||
->ignoreDotFiles(true);
|
||||
|
||||
foreach ($finder as $file) {
|
||||
$app['filesystem']->remove($file);
|
||||
}
|
||||
|
||||
$app['filesystem']->remove($finder);
|
||||
|
||||
foreach ([
|
||||
'config/custom_files/' => 'www/custom/',
|
||||
'config/minilogos/' => 'www/custom/minilogos/',
|
||||
'config/stamp/' => 'www/custom/stamp/',
|
||||
'config/status/' => 'www/custom/status/',
|
||||
'config/wm/' => 'www/custom/wm/',
|
||||
'config/custom_files/' => 'www/custom/',
|
||||
'config/minilogos/' => 'www/custom/minilogos/',
|
||||
'config/stamp/' => 'www/custom/stamp/',
|
||||
'config/status/' => 'www/custom/status/',
|
||||
'config/wm/' => 'www/custom/wm/',
|
||||
] as $source => $target) {
|
||||
$app['filesystem']->mirror($this->app['root.path'] . '/' . $source, $this->app['root.path'] . '/' . $target);
|
||||
$app['filesystem']->mirror($this->app['root.path'] . '/' . $source, $this->app['root.path'] . '/' . $target, null, array('override' => true));
|
||||
}
|
||||
|
||||
$advices = $this->upgradeDB(true, $app);
|
||||
|
@@ -412,7 +412,7 @@ abstract class base implements cache_cacheableInterface
|
||||
{
|
||||
$field_stmt = $defaults_stmt = [];
|
||||
|
||||
$create_stmt = "CREATE TABLE `" . $table['name'] . "` (";
|
||||
$create_stmt = "CREATE TABLE IF NOT EXISTS `" . $table['name'] . "` (";
|
||||
|
||||
foreach ($table->fields->field as $field) {
|
||||
$isnull = trim($field->null) == "" ? "NOT NULL" : "NULL";
|
||||
|
37
lib/classes/connection/pdoStatement.php
Normal file
37
lib/classes/connection/pdoStatement.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class connection_pdoStatement implements \connection_statement
|
||||
{
|
||||
protected $statement;
|
||||
|
||||
public function __construct(\PDOStatement $statement)
|
||||
{
|
||||
$this->statement = $statement;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getQueryString()
|
||||
{
|
||||
return $this->statement->queryString;
|
||||
}
|
||||
|
||||
public function execute($params = array())
|
||||
{
|
||||
return $this->statement->execute($params);
|
||||
}
|
||||
|
||||
public function __call($function_name, $parameters)
|
||||
{
|
||||
return call_user_func_array(array($this->statement, $function_name), $parameters);
|
||||
}
|
||||
}
|
52
lib/classes/connection/pdoStatementReconnectable.php
Normal file
52
lib/classes/connection/pdoStatementReconnectable.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class connection_pdoStatementReconnectable implements \connection_statement
|
||||
{
|
||||
protected $queryString;
|
||||
protected $statement;
|
||||
protected $conn;
|
||||
|
||||
public function __construct(\connection_statement $statement, \connection_pdo $conn)
|
||||
{
|
||||
$this->statement = $statement;
|
||||
$this->conn = $conn;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getQueryString()
|
||||
{
|
||||
return $this->statement->getQueryString();
|
||||
}
|
||||
|
||||
public function execute($params = array())
|
||||
{
|
||||
try {
|
||||
return $this->statement->execute($params);
|
||||
} catch (\Exception $e) {
|
||||
$unreachable = ($e->getCode() === 2006) || (false !== strpos($e->getMessage(), 'MySQL server has gone away')) || (false !== strpos($e->getMessage(), 'errno=32 Broken pipe'));
|
||||
if (!$unreachable) {
|
||||
throw $e;
|
||||
}
|
||||
$this->conn->connect();
|
||||
}
|
||||
// retry query with update statement
|
||||
$this->statement = $this->conn->prepare($this->getQueryString());
|
||||
|
||||
return $this->statement->execute($params);
|
||||
}
|
||||
|
||||
public function __call($function_name, $parameters)
|
||||
{
|
||||
return call_user_func_array(array($this->statement, $function_name), $parameters);
|
||||
}
|
||||
}
|
16
lib/classes/connection/statement.php
Normal file
16
lib/classes/connection/statement.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
interface connection_statement
|
||||
{
|
||||
public function execute($params = array());
|
||||
public function getQueryString();
|
||||
}
|
@@ -419,14 +419,18 @@ class databox extends base
|
||||
|
||||
public function get_indexed_record_amount()
|
||||
{
|
||||
|
||||
$sql = "SELECT status & 3 AS status, SUM(1) AS n FROM record GROUP BY(status & 3)";
|
||||
$stmt = $this->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$ret = ['xml_indexed' => 0, 'thesaurus_indexed' => 0];
|
||||
$ret = array(
|
||||
'xml_indexed' => 0,
|
||||
'thesaurus_indexed' => 0,
|
||||
'jeton_subdef' => array()
|
||||
);
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$status = $row['status'];
|
||||
if ($status & 1)
|
||||
@@ -435,6 +439,21 @@ class databox extends base
|
||||
$ret['thesaurus_indexed'] += $row['n'];
|
||||
}
|
||||
|
||||
$sql = "SELECT type, jeton, COUNT(record_id) AS n FROM record WHERE jeton & ".JETON_MAKE_SUBDEF." GROUP BY type, jeton";
|
||||
$stmt = $this->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
foreach ($rs as $row) {
|
||||
if(!array_key_exists($row['type'], $ret['jeton_subdef'])) {
|
||||
$ret['jeton_subdef'][$row['type']] = 0;
|
||||
}
|
||||
if((int)$row['jeton'] & JETON_MAKE_SUBDEF) {
|
||||
$ret['jeton_subdef'][$row['type']] += (int)$row['n'];
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -575,7 +594,7 @@ class databox extends base
|
||||
$databox = $app['phraseanet.appbox']->get_databox($sbas_id);
|
||||
$databox->insert_datas();
|
||||
$databox->setNewStructure(
|
||||
$data_template, $app['conf']->get(['main', 'storage', 'subdefs', 'default-dir'])
|
||||
$data_template, $app['conf']->get(['main', 'storage', 'subdefs'])
|
||||
);
|
||||
|
||||
return $databox;
|
||||
@@ -915,7 +934,7 @@ class databox extends base
|
||||
|
||||
$contents = str_replace(
|
||||
["{{basename}}", "{{datapathnoweb}}"]
|
||||
, [$this->dbname, $path_doc]
|
||||
, [$this->dbname, rtrim($path_doc, '/').'/']
|
||||
, $contents
|
||||
);
|
||||
|
||||
|
@@ -42,7 +42,7 @@ class module_console_sphinxGenerateSuggestion extends Command
|
||||
)
|
||||
));
|
||||
|
||||
$tmp_file = $this->container['root.path'] . '/tmp/dict' . $index . '.txt';
|
||||
$tmp_file = sys_get_temp_dir().'/dict' . $index . '.txt';
|
||||
|
||||
$databox = $this->getService('phraseanet.appbox')->get_databox($sbas_id);
|
||||
|
||||
|
@@ -31,21 +31,16 @@ class module_console_systemClearCache extends Command
|
||||
{
|
||||
$finder = new Finder();
|
||||
|
||||
$in = [];
|
||||
foreach ($this->container['cache.paths'] as $path) {
|
||||
$in[] = $path;
|
||||
};
|
||||
$finder
|
||||
->exclude('.git')
|
||||
->exclude('.svn')
|
||||
->in([
|
||||
$this->container['root.path'] . '/tmp/cache_minify/',
|
||||
$this->container['root.path'] . '/tmp/cache_twig/',
|
||||
$this->container['root.path'] . '/tmp/translations/',
|
||||
$this->container['root.path'] . '/tmp/cache/profiler/',
|
||||
$this->container['root.path'] . '/tmp/doctrine/',
|
||||
$this->container['root.path'] . '/tmp/serializer/',
|
||||
]);
|
||||
->in($in);
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
|
||||
$filesystem->remove($finder);
|
||||
$this->container['filesystem']->remove($finder);
|
||||
|
||||
if ($this->container['phraseanet.configuration-tester']->isInstalled()) {
|
||||
$this->getService('phraseanet.cache-service')->flushAll();
|
||||
|
@@ -641,8 +641,9 @@ class module_report_activity extends module_report
|
||||
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
|
||||
WHERE log.site = :site_id
|
||||
AND log_date.action = 'download'
|
||||
AND (" . $datefilter['sql'] . ")
|
||||
AND (" . $collfilter['sql'] . ")
|
||||
AND (" . $datefilter['sql'] . ")" .
|
||||
(('' !== $collfilter['sql']) ? "AND (" . $collfilter['sql'] . ")" : '')
|
||||
. "
|
||||
) AS tt
|
||||
LEFT JOIN subdef AS s ON (s.record_id = tt.record_id)
|
||||
WHERE s.name = tt.final
|
||||
@@ -715,9 +716,9 @@ class module_report_activity extends module_report
|
||||
SELECT DISTINCT(log_date.id), log_date.date AS heures
|
||||
FROM log AS log_date FORCE INDEX (date_site)
|
||||
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
|
||||
WHERE " . $datefilter['sql'] . "
|
||||
AND " . $collfilter['sql'] . "
|
||||
AND log_date.site = :site_id
|
||||
WHERE " . $datefilter['sql'] . "" .
|
||||
(('' !== $collfilter['sql']) ? "AND (" . $collfilter['sql'] . ")" : '')
|
||||
. " AND log_date.site = :site_id
|
||||
) AS tt";
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -747,12 +748,10 @@ class module_report_activity extends module_report
|
||||
{
|
||||
$databox = $app['phraseanet.appbox']->get_databox($sbas_id);
|
||||
$conn = $databox->get_connection();
|
||||
$result = [];
|
||||
$res = [];
|
||||
$datefilter =
|
||||
module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter =
|
||||
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
$result = array();
|
||||
$res = array();
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = [':site_id' => $app['conf']->get(['main', 'key'])];
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
@@ -763,9 +762,9 @@ class module_report_activity extends module_report
|
||||
SELECT DISTINCT(log_date.id), DATE_FORMAT( log_date.date, '%Y-%m-%d' ) AS ddate
|
||||
FROM log AS log_date FORCE INDEX (date_site) INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
|
||||
WHERE " . $datefilter['sql'] . "
|
||||
AND log_date.site = :site_id
|
||||
AND (" . $collfilter['sql'] . ")
|
||||
) AS tt
|
||||
AND log_date.site = :site_id" .
|
||||
(('' !== $collfilter['sql']) ? (" AND (" . $collfilter['sql'] . ")") : '')
|
||||
. ") AS tt
|
||||
GROUP by tt.ddate
|
||||
ORDER BY tt.ddate ASC";
|
||||
|
||||
@@ -807,9 +806,9 @@ class module_report_activity extends module_report
|
||||
INNER JOIN log AS log_date FORCE INDEX (date_site) ON (log_search.log_id = log_date.id)
|
||||
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
|
||||
WHERE " . $datefilter['sql'] . "
|
||||
AND log_date.site = :site_id
|
||||
AND (" . $collfilter['sql'] . ")
|
||||
) AS tt
|
||||
AND log_date.site = :site_id" .
|
||||
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
|
||||
. ") AS tt
|
||||
GROUP BY tt.usrid
|
||||
ORDER BY nb DESC";
|
||||
|
||||
@@ -848,9 +847,9 @@ class module_report_activity extends module_report
|
||||
INNER JOIN log AS log_date FORCE INDEX (date_site) ON (log_search.log_id = log_date.id)
|
||||
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
|
||||
WHERE " . $datefilter['sql'] . "
|
||||
AND log_date.site = :site_id
|
||||
AND (" . $collfilter['sql'] . ")
|
||||
) AS tt
|
||||
AND log_date.site = :site_id" .
|
||||
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
|
||||
. ") AS tt
|
||||
GROUP BY tt.search
|
||||
ORDER BY nb DESC";
|
||||
|
||||
@@ -889,9 +888,9 @@ class module_report_activity extends module_report
|
||||
FROM (log_view)
|
||||
INNER JOIN log AS log_date FORCE INDEX (date_site) ON (log_view.log_id = log_date.id)
|
||||
INNER JOIN log_colls FORCE INDEX (couple) ON (log_date.id = log_colls.log_id)
|
||||
WHERE " . $datefilter['sql'] . "
|
||||
AND (" . $collfilter['sql'] . ")
|
||||
) AS tt
|
||||
WHERE " . $datefilter['sql'] . "" .
|
||||
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
|
||||
. ") AS tt
|
||||
GROUP BY referrer
|
||||
ORDER BY nb_view DESC ";
|
||||
|
||||
@@ -933,8 +932,9 @@ class module_report_activity extends module_report
|
||||
FROM (log_docs AS log_date)
|
||||
INNER JOIN log FORCE INDEX (date_site) ON (log_date.log_id = log.id)
|
||||
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
|
||||
WHERE " . $datefilter['sql'] . " AND log_date.action = 'add'
|
||||
AND (" . $collfilter['sql'] . ")
|
||||
WHERE " . $datefilter['sql'] . " AND log_date.action = 'add' " .
|
||||
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
|
||||
. "
|
||||
) AS tt
|
||||
GROUP BY tt.ddate
|
||||
ORDER BY activity ASC ";
|
||||
@@ -969,9 +969,9 @@ class module_report_activity extends module_report
|
||||
FROM (log_docs AS log_date)
|
||||
INNER JOIN log FORCE INDEX (date_site) ON (log_date.log_id = log.id)
|
||||
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
|
||||
WHERE " . $datefilter['sql'] . " AND log_date.action = 'edit'
|
||||
AND (" . $collfilter['sql'] . ")
|
||||
) AS tt
|
||||
WHERE " . $datefilter['sql'] . " AND log_date.action = 'edit'" .
|
||||
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
|
||||
. ") AS tt
|
||||
GROUP BY tt.ddate
|
||||
ORDER BY activity ASC ";
|
||||
|
||||
@@ -1006,9 +1006,9 @@ class module_report_activity extends module_report
|
||||
FROM (log_docs AS log_date)
|
||||
INNER JOIN log FORCE INDEX (date_site) ON (log_date.log_id = log.id)
|
||||
INNER JOIN log_colls FORCE INDEX (couple) ON (log.id = log_colls.log_id)
|
||||
WHERE " . $datefilter['sql'] . " AND log_date.action = 'add'
|
||||
AND (" . $collfilter['sql'] . ")
|
||||
) AS tt
|
||||
WHERE " . $datefilter['sql'] . " AND log_date.action = 'add'" .
|
||||
(('' !== $collfilter['sql']) ? " AND (" . $collfilter['sql'] . ")" : '')
|
||||
. ") AS tt
|
||||
GROUP BY tt.usrid
|
||||
ORDER BY nb ASC ";
|
||||
|
||||
|
@@ -50,7 +50,11 @@ class module_report_sqlfilter
|
||||
$coll_filter[] = 'log_colls.coll_id = ' . $val;
|
||||
}
|
||||
}
|
||||
$ret['sql'] = ' (' . implode(' OR ', array_unique($coll_filter)) . ') ';
|
||||
$collections = array_unique($coll_filter);
|
||||
|
||||
if (count($collections) > 0) {
|
||||
$ret['sql'] = ' (' . implode(' OR ', $collections) . ') ';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
@@ -66,15 +70,15 @@ class module_report_sqlfilter
|
||||
|
||||
$params = [':log_site' => $this->app['conf']->get(['main', 'key'])];
|
||||
|
||||
if ($this->filter['date']) {
|
||||
if ($this->filter['date'] && $this->filter['date']['sql'] !== '') {
|
||||
$finalfilter .= $this->filter['date']['sql'] . ' AND ';
|
||||
$params = array_merge($params, $this->filter['date']['params']);
|
||||
}
|
||||
if ($this->filter['user']) {
|
||||
if ($this->filter['user'] && $this->filter['user']['sql'] !== '') {
|
||||
$finalfilter .= $this->filter['user']['sql'] . ' AND ';
|
||||
$params = array_merge($params, $this->filter['user']['params']);
|
||||
}
|
||||
if ($this->filter['collection']) {
|
||||
if ($this->filter['collection'] && $this->filter['collection']['sql'] !== '') {
|
||||
$finalfilter .= $this->filter['collection']['sql'] . ' AND ';
|
||||
$params = array_merge($params, $this->filter['collection']['params']);
|
||||
}
|
||||
@@ -174,9 +178,12 @@ class module_report_sqlfilter
|
||||
|
||||
$n ++;
|
||||
}
|
||||
$filter_user = ['sql' => implode(' AND ', $filter), 'params' => $params];
|
||||
|
||||
$this->filter['user'] = $filter_user;
|
||||
if (count($filter) > 0) {
|
||||
$filter_user = array('sql' => implode(' AND ', $filter), 'params' => $params);
|
||||
$this->filter['user'] = $filter_user;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -201,7 +208,11 @@ class module_report_sqlfilter
|
||||
}
|
||||
}
|
||||
|
||||
$this->filter['collection'] = ['sql' => ' (' . implode(' OR ', array_unique($coll_filter)) . ') ', 'params' => []];
|
||||
$collections = array_unique($coll_filter);
|
||||
|
||||
if (count($collections) > 0) {
|
||||
$this->filter['collection'] = array('sql' => ' (' . implode(' OR ', array_unique($coll_filter)) . ') ', 'params' => array());
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -219,7 +230,9 @@ class module_report_sqlfilter
|
||||
$params[":record_fil" . $n] = phrasea::collFromBas($this->app, $val);
|
||||
$n ++;
|
||||
}
|
||||
$this->filter['record'] = ['sql' => implode(' OR ', $dl_coll_filter), 'params' => $params];
|
||||
if (count($dl_coll_filter) > 0) {
|
||||
$this->filter['record'] = array('sql' => implode(' OR ', $dl_coll_filter), 'params' => $params);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
@@ -89,7 +89,7 @@ class patch_370alpha7a extends patchAbstract
|
||||
$i = 0;
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$filePath = $app['root.path'] . '/tmp/lazaret/' . $row['filepath'];
|
||||
$filePath = $app['tmp.lazaret.path'].'/'.$row['filepath'];
|
||||
if (null === $user = $this->loadUser($app['EM'], $row['usr_id'])) {
|
||||
continue;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ class patch_370alpha7a extends patchAbstract
|
||||
$spec->setResizeMode(ImageSpec::RESIZE_MODE_INBOUND_FIXEDRATIO);
|
||||
$spec->setDimensions(375, 275);
|
||||
|
||||
$thumbPath = $app['root.path'] . '/tmp/lazaret/' . sprintf("thumb_%s", $row['filepath']);
|
||||
$thumbPath = $app['tmp.lazaret.path'].'/'.sprintf("thumb_%s", $row['filepath']);
|
||||
|
||||
try {
|
||||
$app['media-alchemyst']->turnInto($filePath, $thumbPath, $spec);
|
||||
|
@@ -63,11 +63,11 @@ class patch_380alpha16a extends patchAbstract
|
||||
}
|
||||
|
||||
$xsendfile['mapping'][] = [
|
||||
'directory' => $app['root.path'] . '/tmp/lazaret/',
|
||||
'directory' => $app['tmp.lazaret.path'],
|
||||
'mount-point' => '/lazaret/',
|
||||
];
|
||||
$xsendfile['mapping'][] = [
|
||||
'directory' => $app['root.path'] . '/tmp/download/',
|
||||
'directory' => $app['tmp.download.path'],
|
||||
'mount-point' => '/download/',
|
||||
];
|
||||
|
||||
|
85
lib/classes/patch/386alpha2a.php
Normal file
85
lib/classes/patch/386alpha2a.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Utilities\CrossDomainParser;
|
||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||
|
||||
class patch_386alpha2a implements patchInterface
|
||||
{
|
||||
/** @var string */
|
||||
private $release = '3.8.6-alpha.2';
|
||||
|
||||
/** @var array */
|
||||
private $concern = array(base::APPLICATION_BOX);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_release()
|
||||
{
|
||||
return $this->release;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function require_all_upgrades()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function concern()
|
||||
{
|
||||
return $this->concern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns doctrine migrations needed for the patch.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDoctrineMigrations()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function apply(base $appbox, Application $app)
|
||||
{
|
||||
$config = $app['phraseanet.configuration']->getConfig();
|
||||
|
||||
$parser = new CrossDomainParser();
|
||||
try {
|
||||
$crossDomainConfig = $parser->parse($app['root.path'].'/www/crossdomain.xml');
|
||||
} catch (RuntimeException $e) {
|
||||
$crossDomainConfig = array(
|
||||
'allow-access-from' => array(
|
||||
array(
|
||||
'domain' => '*.cooliris.com',
|
||||
'secure' => 'false',
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$config['crossdomain'] = $crossDomainConfig;
|
||||
|
||||
$app['phraseanet.configuration']->setConfig($config);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
100
lib/classes/patch/390alpha19a.php
Normal file
100
lib/classes/patch/390alpha19a.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
class patch_390alpha19a extends patchAbstract
|
||||
{
|
||||
/** @var string */
|
||||
private $release = '3.9.0-alpha.19';
|
||||
|
||||
/** @var array */
|
||||
private $concern = [base::APPLICATION_BOX];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_release()
|
||||
{
|
||||
return $this->release;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function require_all_upgrades()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function concern()
|
||||
{
|
||||
return $this->concern;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDoctrineMigrations()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function apply(base $appbox, Application $app)
|
||||
{
|
||||
$storage = $app['conf']->get(['main', 'storage']);
|
||||
$storage['cache'] = $app['root.path'].'/cache';
|
||||
$storage['log'] = $app['root.path'].'/logs';
|
||||
$storage['download'] = $app['root.path'].'/tmp/download';
|
||||
$storage['lazaret'] = $app['root.path'].'/tmp/lazaret';
|
||||
$storage['caption'] = $app['root.path'].'/tmp/caption';
|
||||
$app['conf']->set(['main', 'storage'], $storage);
|
||||
|
||||
// update file structure
|
||||
$this->removeDirectory($app, $app['root.path'].'/tmp/cache_twig');
|
||||
$this->removeDirectory($app, $app['root.path'].'/tmp/doctrine');
|
||||
$this->removeDirectory($app, $app['root.path'].'/tmp/profiler');
|
||||
$this->removeDirectory($app, $app['root.path'].'/tmp/serializer');
|
||||
$this->removeDirectory($app, $app['root.path'].'/tmp/translations');
|
||||
$this->removeDirectory($app, $app['root.path'].'/tmp/cache_minify');
|
||||
$this->removeDirectory($app, $app['root.path'].'/features');
|
||||
$this->removeDirectory($app, $app['root.path'].'/hudson');
|
||||
$this->removeDirectory($app, $app['root.path'].'/locales');
|
||||
$this->removeDirectory($app, $app['root.path'].'/vagrant');
|
||||
$this->removeDirectory($app, $app['root.path'].'/tmp/doctrine-proxies');
|
||||
|
||||
|
||||
$this->copyFile($app, $app['root.path'].'/tmp/cache_registry.php', $app['cache.path'].'/cache_registry.php');
|
||||
$this->copyFile($app, $app['root.path'].'/tmp/configuration-compiled.php', $app['root.path'].'/config/configuration-compiled.php');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function removeDirectory(Application $app, $originDir)
|
||||
{
|
||||
if (is_dir($originDir)) {
|
||||
$app['filesystem']->remove($originDir);
|
||||
}
|
||||
}
|
||||
|
||||
private function copyFile(Application $app, $originFile, $targetFile)
|
||||
{
|
||||
if ($app['filesystem']->exists($originFile)) {
|
||||
$app['filesystem']->copy($originFile, $targetFile);
|
||||
}
|
||||
}
|
||||
}
|
@@ -165,7 +165,7 @@ class patch_390alpha9b extends patchAbstract
|
||||
'GV_smtp_secure' => ['registry', 'email', 'smtp-secure-mode'],
|
||||
'GV_smtp_user' => ['registry', 'email', 'smtp-user'],
|
||||
'GV_smtp_password' => ['registry', 'email', 'smtp-password'],
|
||||
'GV_base_datapath_noweb' => ['main', 'storage', 'subdefs', 'default-dir'],
|
||||
'GV_base_datapath_noweb' => ['main', 'storage', 'subdefs'],
|
||||
'GV_youtube_api' => ['main', 'bridge', 'youtube', 'enabled'],
|
||||
'GV_youtube_client_id' => ['main', 'bridge', 'youtube', 'client_id'],
|
||||
'GV_youtube_client_secret' => ['main', 'bridge', 'youtube', 'client_secret'],
|
||||
|
@@ -41,7 +41,7 @@ class random
|
||||
switch ($row['type']) {
|
||||
case 'download':
|
||||
case 'email':
|
||||
$file = $this->app['root.path'] . '/tmp/download/' . $row['value'] . '.zip';
|
||||
$file = $this->app['tmp.download.path'].'/'.$row['value'].'.zip';
|
||||
if (is_file($file))
|
||||
unlink($file);
|
||||
break;
|
||||
|
@@ -631,8 +631,7 @@ class set_export extends set_abstract
|
||||
$files[$id]["export_name"] = $tmp_name;
|
||||
|
||||
if (in_array('caption', $subdefs)) {
|
||||
$caption_dir = $this->app['root.path'] . '/tmp/desc_tmp/'
|
||||
. time() . $this->app['authentication']->getUser()->getId() . '/';
|
||||
$caption_dir = $this->app['tmp.caption.path'].'/'.time().$this->app['authentication']->getUser()->getId().'/';
|
||||
|
||||
$filesystem->mkdir($caption_dir, 0750);
|
||||
|
||||
@@ -653,8 +652,7 @@ class set_export extends set_abstract
|
||||
}
|
||||
|
||||
if (in_array('caption-yaml', $subdefs)) {
|
||||
$caption_dir = $this->app['root.path'] . '/tmp/desc_tmp/'
|
||||
. time() . $this->app['authentication']->getUser()->getId() . '/';
|
||||
$caption_dir = $this->app['tmp.caption.path'].'/'.time().$this->app['authentication']->getUser()->getId().'/';
|
||||
|
||||
$filesystem->mkdir($caption_dir, 0750);
|
||||
|
||||
|
Reference in New Issue
Block a user