mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 03:23:19 +00:00
Merge branch '3.6' of github.com:alchemy-fr/Phraseanet into 3.6
This commit is contained in:
@@ -5,12 +5,12 @@ Phraseanet 3.5 - Digital Asset Management application
|
||||
|
||||
Metadatas Management (include Thesaurus and DublinCore Mapping)
|
||||
Search Engine (Sphinx Search Integration)
|
||||
RestFull APIS (See Developer Documentation http://docs.phraseanet.com/Devel)
|
||||
RestFull APIS (See Developer Documentation https://docs.phraseanet.com/3.6/Devel)
|
||||
Bridge to Youtube/Dailymotion/Flickr
|
||||
|
||||
#Documentation :
|
||||
|
||||
http://docs.phraseanet.com
|
||||
https://docs.phraseanet.com/3.6/
|
||||
|
||||
#Easy Installation
|
||||
|
||||
|
@@ -64,6 +64,7 @@ try
|
||||
$app->add(new module_console_schedulerStart('scheduler:start'));
|
||||
$app->add(new module_console_fileConfigCheck('check:config'));
|
||||
$app->add(new module_console_fileEnsureProductionSetting('check:ensureProductionSettings'));
|
||||
$app->add(new module_console_fileEnsureDevSetting('check:ensureDevSettings'));
|
||||
$app->add(new module_console_systemConfigCheck('check:system'));
|
||||
$result_code = $app->run();
|
||||
}
|
||||
|
@@ -29,11 +29,7 @@ bootstrap::register_autoloads();
|
||||
|
||||
try
|
||||
{
|
||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
||||
);
|
||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||
|
||||
$serviceName = $configuration->getOrm();
|
||||
$confService = $configuration->getService($serviceName);
|
||||
|
@@ -41,8 +41,8 @@ prod:
|
||||
|
||||
template_engine: twig
|
||||
orm: doctrine_prod
|
||||
cache: memcache_cache
|
||||
opcodecache: apc_cache
|
||||
cache: array_cache
|
||||
opcodecache: array_cache
|
||||
|
||||
##############
|
||||
# TEST #
|
||||
|
@@ -52,11 +52,11 @@ Orm:
|
||||
dbal: main_connexion
|
||||
cache:
|
||||
query:
|
||||
service: Cache\apc_cache
|
||||
service: Cache\array_cache
|
||||
result:
|
||||
service: Cache\memcache_cache
|
||||
service: Cache\array_cache
|
||||
metadata:
|
||||
service: Cache\apc_cache
|
||||
service: Cache\array_cache
|
||||
|
||||
TemplateEngine:
|
||||
#Define a template engine service
|
||||
|
@@ -38,7 +38,7 @@ echo "ok !";
|
||||
# Valid link ?
|
||||
|
||||
echo -n "Check link validity : ";
|
||||
wget --no-check-certificate $instance -o /dev/null
|
||||
wget --no-check-certificate $instance --output-document=/dev/null
|
||||
if [ ! $? -eq 0 ]
|
||||
then
|
||||
echo "Link does not exists.";
|
||||
@@ -60,10 +60,11 @@ do
|
||||
echo "nok !";
|
||||
cat /tmp/jsunitphantom;
|
||||
testOK=1;
|
||||
else
|
||||
echo "ok !";
|
||||
fi
|
||||
echo "";
|
||||
echo "";
|
||||
echo "";
|
||||
done
|
||||
|
||||
exit $testOK;
|
||||
|
@@ -317,6 +317,19 @@ return call_user_func(function()
|
||||
);
|
||||
|
||||
|
||||
$route = '/records/{databox_id}/{record_id}/caption/';
|
||||
$app->get(
|
||||
$route, function($databox_id, $record_id) use ($app)
|
||||
{
|
||||
$result = $app['api']->caption_records($app['request'], $databox_id, $record_id);
|
||||
|
||||
return $app['response']($result);
|
||||
}
|
||||
)->assert('databox_id', '\d+')->assert('record_id', '\d+');
|
||||
|
||||
$app->get('/records/{any_id}/{anyother_id}/caption/', $bad_request_exception);
|
||||
|
||||
|
||||
/**
|
||||
* Route : /records/DATABOX_ID/RECORD_ID/metadatas/FORMAT/
|
||||
*
|
||||
|
@@ -232,7 +232,7 @@ return call_user_func(
|
||||
$repository = $em->getRepository('\Entities\Basket');
|
||||
|
||||
/* @var $repository \Repositories\BasketRepository */
|
||||
$basket_collection = $repository->findActiveByUser(
|
||||
$basket_collection = $repository->findActiveValidationAndBasketByUser(
|
||||
$app['Core']->getAuthenticatedUser()
|
||||
);
|
||||
|
||||
@@ -290,7 +290,7 @@ return call_user_func(
|
||||
$repository = $em->getRepository('\Entities\Basket');
|
||||
|
||||
/* @var $repository \Repositories\BasketRepository */
|
||||
$basket_collection = $repository->findActiveByUser(
|
||||
$basket_collection = $repository->findActiveValidationAndBasketByUser(
|
||||
$app['Core']->getAuthenticatedUser()
|
||||
);
|
||||
|
||||
|
@@ -52,4 +52,9 @@ class ApcCache extends DoctrineApc implements Cache
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function flush()
|
||||
{
|
||||
return apc_clear_cache() && apc_clear_cache('user');
|
||||
}
|
||||
|
||||
}
|
@@ -53,4 +53,11 @@ class ArrayCache extends DoctrineArray implements Cache
|
||||
return;
|
||||
}
|
||||
|
||||
public function flush()
|
||||
{
|
||||
$this->deleteAll();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@@ -26,6 +26,8 @@ interface Cache extends DoctrineCache
|
||||
|
||||
public function getStats();
|
||||
|
||||
public function flush();
|
||||
|
||||
public function get($key);
|
||||
|
||||
public function deleteMulti(array $array_keys);
|
||||
|
@@ -60,7 +60,7 @@ class Manager
|
||||
{
|
||||
foreach ($this->registry as $cacheKey => $service_name)
|
||||
{
|
||||
$this->get($cacheKey, $service_name)->getDriver()->deleteAll();
|
||||
$this->get($cacheKey, $service_name)->getDriver()->flush();
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -71,6 +71,8 @@ class Manager
|
||||
try
|
||||
{
|
||||
$configuration = $this->core->getConfiguration()->getService($service_name);
|
||||
$service = Builder::create($this->core, $service_name, $configuration);
|
||||
$driver = $service->getDriver();
|
||||
$write = true;
|
||||
}
|
||||
catch (\Exception $e)
|
||||
@@ -78,15 +80,16 @@ class Manager
|
||||
$configuration = new \Symfony\Component\DependencyInjection\ParameterBag\ParameterBag(
|
||||
array('type' => 'Cache\\ArrayCache')
|
||||
);
|
||||
$service = Builder::create($this->core, $service_name, $configuration);
|
||||
$driver = $service->getDriver();
|
||||
$write = false;
|
||||
}
|
||||
|
||||
$service = Builder::create($this->core, $service_name, $configuration);
|
||||
|
||||
if ($this->hasChange($cacheKey, $service_name))
|
||||
{
|
||||
$service->getDriver()->deleteAll();
|
||||
if($write)
|
||||
$driver->flush();
|
||||
|
||||
if ($write)
|
||||
{
|
||||
$this->registry[$cacheKey] = $service_name;
|
||||
$this->save($cacheKey, $service_name);
|
||||
|
@@ -52,4 +52,9 @@ class MemcacheCache extends DoctrineMemcache implements Cache
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function flush()
|
||||
{
|
||||
return $this->getMemcache()->flush();
|
||||
}
|
||||
|
||||
}
|
@@ -23,7 +23,7 @@ class RedisCache extends AbstractCache implements Cache
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Memcache
|
||||
* @var \Redis
|
||||
*/
|
||||
private $_redis;
|
||||
|
||||
@@ -124,4 +124,9 @@ class RedisCache extends AbstractCache implements Cache
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function flush()
|
||||
{
|
||||
return $this->_redis->flushAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -52,4 +52,9 @@ class XcacheCache extends DoctrineXcache implements Cache
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function flush()
|
||||
{
|
||||
return xcache_clear_cache(XC_TYPE_VAR, 0);
|
||||
}
|
||||
|
||||
}
|
@@ -99,18 +99,6 @@ class Description implements ControllerProviderInterface
|
||||
$field->set_dces_element($dces_element);
|
||||
$field->save();
|
||||
|
||||
if ($request->get('regname') == $field->get_id())
|
||||
{
|
||||
$field->set_regname();
|
||||
}
|
||||
if ($request->get('regdate') == $field->get_id())
|
||||
{
|
||||
$field->set_regdate();
|
||||
}
|
||||
if ($request->get('regdesc') == $field->get_id())
|
||||
{
|
||||
$field->set_regdesc();
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
|
@@ -413,10 +413,28 @@ class Basket implements ControllerProviderInterface
|
||||
|
||||
$basket->addBasketElement($basket_element);
|
||||
|
||||
if(null !== $validationSession = $basket->getValidation())
|
||||
{
|
||||
if(false !== $validationSession->isFinished())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$participants = $validationSession->getParticipants();
|
||||
|
||||
foreach($participants as $participant)
|
||||
{
|
||||
$validationData = new \Entities\ValidationData();
|
||||
$validationData->setParticipant($participant);
|
||||
$validationData->setBasketElement($basket_element);
|
||||
|
||||
$em->persist($validationData);
|
||||
}
|
||||
}
|
||||
|
||||
$n++;
|
||||
}
|
||||
|
||||
$em->merge($basket);
|
||||
$em->flush();
|
||||
|
||||
$data = array(
|
||||
|
@@ -183,10 +183,12 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
|
||||
$push_name = $request->get(
|
||||
'name'
|
||||
, sprintf(_('Push from %s'), $user->get_display_name())
|
||||
);
|
||||
$push_name = $request->get('name');
|
||||
|
||||
if (trim($push_name) === '')
|
||||
{
|
||||
$push_name = sprintf(_('Push from %s'), $user->get_display_name());
|
||||
}
|
||||
|
||||
$push_description = $request->get('push_description');
|
||||
|
||||
@@ -322,10 +324,12 @@ class Push implements ControllerProviderInterface
|
||||
|
||||
$repository = $em->getRepository('\Entities\Basket');
|
||||
|
||||
$validation_name = $request->get(
|
||||
'name'
|
||||
, sprintf(_('Validation from %s'), $user->get_display_name())
|
||||
);
|
||||
$validation_name = $request->get('name');
|
||||
|
||||
if (trim($validation_name) === '')
|
||||
{
|
||||
$validation_name = sprintf(_('Validation from %s'), $user->get_display_name());
|
||||
}
|
||||
|
||||
$validation_description = $request->get('validation_description');
|
||||
|
||||
|
@@ -205,11 +205,9 @@ class Query implements ControllerProviderInterface
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$json['results'] = $twig->render($template, array(
|
||||
'results' => $result,
|
||||
'GV_social_tools' => $registry->get('GV_social_tools'),
|
||||
'array_selected' => explode(';', $request->get('sel')),
|
||||
'highlight' => $search_engine->get_query(),
|
||||
'searchEngine' => $search_engine,
|
||||
'suggestions' => $prop
|
||||
|
@@ -18,6 +18,7 @@ use Symfony\Component\HttpFoundation\Request,
|
||||
Symfony\Component\HttpFoundation\Response,
|
||||
Symfony\Component\HttpFoundation\RedirectResponse,
|
||||
Symfony\Component\HttpKernel\Exception\HttpException,
|
||||
Symfony\Component\Finder\Finder,
|
||||
Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Alchemy\Phrasea\Helper;
|
||||
|
||||
@@ -40,49 +41,56 @@ class Root implements ControllerProviderInterface
|
||||
\User_Adapter::updateClientInfos(1);
|
||||
|
||||
$appbox = \appbox::get_instance($app['Core']);
|
||||
$css = array();
|
||||
$cssfile = false;
|
||||
$registry = $app['Core']->getRegistry();
|
||||
|
||||
$session = $appbox->get_session();
|
||||
$user = $app['Core']->getAuthenticatedUser();
|
||||
|
||||
$cssPath = $registry->get('GV_RootPath') . 'www/skins/prod/';
|
||||
|
||||
if ($hdir = opendir($cssPath))
|
||||
$css = array();
|
||||
$cssfile = false;
|
||||
|
||||
$finder = new Finder();
|
||||
|
||||
$iterator = $finder
|
||||
->directories()
|
||||
->depth(0)
|
||||
->filter(function(\SplFileInfo $fileinfo)
|
||||
{
|
||||
while (false !== ($file = readdir($hdir)))
|
||||
return ctype_xdigit($fileinfo->getBasename());
|
||||
})
|
||||
->in($cssPath);
|
||||
|
||||
foreach ($iterator as $dir)
|
||||
{
|
||||
if (substr($file, 0, 1) == "." || mb_strtolower($file) == "cvs")
|
||||
continue;
|
||||
if (is_dir($cssPath . $file))
|
||||
{
|
||||
$css[$file] = $file;
|
||||
}
|
||||
}
|
||||
closedir($hdir);
|
||||
$baseName = $dir->getBaseName();
|
||||
$css[$baseName] = $baseName;
|
||||
}
|
||||
|
||||
$cssfile = $user->getPrefs('css');
|
||||
|
||||
if (!$cssfile && isset($css['000000']))
|
||||
{
|
||||
$cssfile = '000000';
|
||||
}
|
||||
|
||||
|
||||
$user_feeds = \Feed_Collection::load_all($appbox, $user);
|
||||
$feeds = array_merge(array($user_feeds->get_aggregate()), $user_feeds->get_feeds());
|
||||
|
||||
$srt = 'name asc';
|
||||
|
||||
|
||||
$thjslist = "";
|
||||
|
||||
$queries_topics = '';
|
||||
|
||||
if ($registry->get('GV_client_render_topics') == 'popups')
|
||||
$queries_topics = queries::dropdown_topics();
|
||||
{
|
||||
$queries_topics = \queries::dropdown_topics();
|
||||
}
|
||||
elseif ($registry->get('GV_client_render_topics') == 'tree')
|
||||
{
|
||||
$queries_topics = \queries::tree_topics();
|
||||
}
|
||||
|
||||
$sbas = $bas2sbas = array();
|
||||
|
||||
foreach ($appbox->get_databoxes() as $databox)
|
||||
{
|
||||
$sbas_id = $databox->get_sbas_id();
|
||||
@@ -131,8 +139,6 @@ class Root implements ControllerProviderInterface
|
||||
'GV_bitly_key' => $registry->get('GV_bitly_key')
|
||||
));
|
||||
|
||||
|
||||
|
||||
return new Response($out);
|
||||
});
|
||||
|
||||
|
@@ -56,7 +56,9 @@ class Story implements ControllerProviderInterface
|
||||
|
||||
|
||||
if (!$user->ACL()->has_right_on_base($collection->get_base_id(), 'canaddrecord'))
|
||||
{
|
||||
throw new \Exception_Forbidden('You can not create a story on this collection');
|
||||
}
|
||||
|
||||
|
||||
$system_file = new \system_file(
|
||||
@@ -66,26 +68,53 @@ class Story implements ControllerProviderInterface
|
||||
|
||||
$Story = \record_adapter::create($collection, $system_file, false, true);
|
||||
|
||||
foreach (explode(';', $request->get('lst')) as $sbas_rec)
|
||||
{
|
||||
$sbas_rec = explode('_', $sbas_rec);
|
||||
|
||||
if (count($sbas_rec) !== 2)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$record = new \record_adapter($sbas_rec[0], $sbas_rec[1]);
|
||||
|
||||
if (!$user->ACL()->has_access_to_base($record->get_base_id())
|
||||
&& !$user->ACL()->has_hd_grant($record)
|
||||
&& !$user->ACL()->has_preview_grant($record))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($Story->hasChild($record))
|
||||
continue;
|
||||
|
||||
$Story->appendChild($record);
|
||||
}
|
||||
|
||||
$metadatas = array();
|
||||
|
||||
foreach ($collection->get_databox()->get_meta_structure() as $meta)
|
||||
{
|
||||
if ($meta->is_regname())
|
||||
if ($meta->get_thumbtitle())
|
||||
{
|
||||
$value = $request->get('name');
|
||||
elseif ($meta->is_regdesc())
|
||||
$value = $request->get('description');
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$metadatas[] = array(
|
||||
'meta_struct_id' => $meta->get_id()
|
||||
, 'meta_id' => null
|
||||
, 'value' => $value
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$Story->set_metadatas($metadatas)
|
||||
->rebuild_subdefs();
|
||||
$Story->set_metadatas($metadatas)->rebuild_subdefs();
|
||||
|
||||
$StoryWZ = new \Entities\StoryWZ();
|
||||
$StoryWZ->setUser($user);
|
||||
|
@@ -286,7 +286,6 @@ class UsrLists implements ControllerProviderInterface
|
||||
|
||||
$list->setName($list_name);
|
||||
|
||||
$em->merge($list);
|
||||
$em->flush();
|
||||
|
||||
$datas = array(
|
||||
@@ -459,7 +458,7 @@ class UsrLists implements ControllerProviderInterface
|
||||
$list->addUsrListEntry($entry);
|
||||
|
||||
$em->persist($entry);
|
||||
$em->merge($list);
|
||||
|
||||
$inserted_usr_ids[] = $user_entry->get_id();
|
||||
}
|
||||
|
||||
@@ -585,14 +584,12 @@ class UsrLists implements ControllerProviderInterface
|
||||
$list->addUsrListOwner($owner);
|
||||
|
||||
$em->persist($owner);
|
||||
$em->merge($list);
|
||||
}
|
||||
|
||||
$role = $app['request']->get('role');
|
||||
|
||||
$owner->setRole($role);
|
||||
|
||||
$em->merge($owner);
|
||||
$em->flush();
|
||||
|
||||
$datas = array(
|
||||
|
@@ -104,6 +104,35 @@ class Installer implements ControllerProviderInterface
|
||||
$request = $app['request'];
|
||||
|
||||
$warnings = array();
|
||||
|
||||
$php_constraint = \setup::check_php_version();
|
||||
$writability_constraints = \setup::check_writability(new \Setup_Registry());
|
||||
$extension_constraints = \setup::check_php_extension();
|
||||
$opcode_constraints = \setup::check_cache_opcode();
|
||||
$php_conf_constraints = \setup::check_php_configuration();
|
||||
$locales_constraints = \setup::check_system_locales();
|
||||
|
||||
$constraints_coll = array(
|
||||
'php_constraint' => $php_constraint
|
||||
, 'writability_constraints' => $writability_constraints
|
||||
, 'extension_constraints' => $extension_constraints
|
||||
, 'opcode_constraints' => $opcode_constraints
|
||||
, 'php_conf_constraints' => $php_conf_constraints
|
||||
, 'locales_constraints' => $locales_constraints
|
||||
);
|
||||
|
||||
foreach ($constraints_coll as $key => $constraints)
|
||||
{
|
||||
$unset = true;
|
||||
foreach ($constraints as $constraint)
|
||||
{
|
||||
if (!$constraint->is_ok() && !$constraint->is_blocker())
|
||||
{
|
||||
$warnings[] = $constraint->get_message();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($request->getScheme() == 'http')
|
||||
{
|
||||
$warnings[] = _('It is not recommended to install Phraseanet without HTTPS support');
|
||||
@@ -118,6 +147,7 @@ class Installer implements ControllerProviderInterface
|
||||
, 'version_number' => $app['Core']['Version']->getNumber()
|
||||
, 'version_name' => $app['Core']['Version']->getName()
|
||||
, 'warnings' => $warnings
|
||||
, 'error' => $request->get('error')
|
||||
, 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/'
|
||||
, 'discovered_binaries' => \setup::discover_binaries()
|
||||
, 'rootpath' => dirname(dirname(dirname(dirname(__DIR__)))) . '/'
|
||||
|
@@ -275,9 +275,14 @@ class Core extends \Pimple
|
||||
$appbox = \appbox::get_instance($this);
|
||||
$session = \Session_Handler::getInstance($appbox);
|
||||
|
||||
if($session->get_usr_id())
|
||||
{
|
||||
return \User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter
|
||||
*
|
||||
|
@@ -26,6 +26,8 @@ use Alchemy\Phrasea\Core,
|
||||
class ApcCache extends ServiceAbstract implements ServiceInterface
|
||||
{
|
||||
|
||||
protected $cache;
|
||||
|
||||
public function getScope()
|
||||
{
|
||||
return 'cache';
|
||||
@@ -38,11 +40,14 @@ class ApcCache extends ServiceAbstract implements ServiceInterface
|
||||
throw new \Exception('The APC cache requires the APC extension.');
|
||||
}
|
||||
|
||||
$service = new CacheDriver\ApcCache();
|
||||
if (!$this->cache)
|
||||
{
|
||||
$this->cache = new CacheDriver\ApcCache();
|
||||
|
||||
$service->setNamespace(md5(realpath(__DIR__ . '/../../../../../../')));
|
||||
$this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../')));
|
||||
}
|
||||
|
||||
return $service;
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
|
@@ -27,6 +27,8 @@ use Alchemy\Phrasea\Core,
|
||||
class ArrayCache extends ServiceAbstract implements ServiceInterface
|
||||
{
|
||||
|
||||
protected $cache;
|
||||
|
||||
public function getScope()
|
||||
{
|
||||
return 'cache';
|
||||
@@ -34,11 +36,14 @@ class ArrayCache extends ServiceAbstract implements ServiceInterface
|
||||
|
||||
public function getDriver()
|
||||
{
|
||||
$service = new CacheDriver\ArrayCache();
|
||||
if (!$this->cache)
|
||||
{
|
||||
$this->cache = new CacheDriver\ArrayCache();
|
||||
|
||||
$service->setNamespace(md5(realpath(__DIR__ . '/../../../../../../')));
|
||||
$this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../')));
|
||||
}
|
||||
|
||||
return $service;
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
|
@@ -26,6 +26,8 @@ use Alchemy\Phrasea\Core,
|
||||
class MemcacheCache extends ServiceAbstract implements ServiceInterface
|
||||
{
|
||||
|
||||
protected $cache;
|
||||
|
||||
const DEFAULT_HOST = "localhost";
|
||||
const DEFAULT_PORT = "11211";
|
||||
|
||||
@@ -53,6 +55,8 @@ class MemcacheCache extends ServiceAbstract implements ServiceInterface
|
||||
throw new \Exception('The Memcache cache requires the Memcache extension.');
|
||||
}
|
||||
|
||||
if(!$this->cache)
|
||||
{
|
||||
$memcache = new \Memcache();
|
||||
|
||||
$memcache->addServer($this->host, $this->port);
|
||||
@@ -63,17 +67,18 @@ class MemcacheCache extends ServiceAbstract implements ServiceInterface
|
||||
|
||||
if (isset($stats[$key]))
|
||||
{
|
||||
$service = new CacheDriver\MemcacheCache();
|
||||
$service->setMemcache($memcache);
|
||||
$this->cache = new CacheDriver\MemcacheCache();
|
||||
$this->cache->setMemcache($memcache);
|
||||
|
||||
$this->cache->setNamespace(md5(realpath(__DIR__.'/../../../../../../')));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \Exception(sprintf("Memcache instance with host '%s' and port '%s' is not reachable", $this->host, $this->port));
|
||||
}
|
||||
}
|
||||
|
||||
$service->setNamespace(md5(realpath(__DIR__.'/../../../../../../')));
|
||||
|
||||
return $service;
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
|
@@ -26,6 +26,8 @@ use Alchemy\Phrasea\Core,
|
||||
class RedisCache extends ServiceAbstract implements ServiceInterface
|
||||
{
|
||||
|
||||
protected $cache;
|
||||
|
||||
const DEFAULT_HOST = "localhost";
|
||||
const DEFAULT_PORT = "6379";
|
||||
|
||||
@@ -34,7 +36,7 @@ class RedisCache extends ServiceAbstract implements ServiceInterface
|
||||
|
||||
public function __construct(Core $core, $name, Array $options)
|
||||
{
|
||||
parent::__construct( $core, $name, $options);
|
||||
parent::__construct($core, $name, $options);
|
||||
|
||||
$this->host = isset($options["host"]) ? $options["host"] : self::DEFAULT_HOST;
|
||||
|
||||
@@ -57,6 +59,9 @@ class RedisCache extends ServiceAbstract implements ServiceInterface
|
||||
throw new \Exception('The Redis cache requires the Redis extension.');
|
||||
}
|
||||
|
||||
|
||||
if (!$this->cache)
|
||||
{
|
||||
$redis = new \Redis();
|
||||
|
||||
if (!$redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_IGBINARY))
|
||||
@@ -66,17 +71,18 @@ class RedisCache extends ServiceAbstract implements ServiceInterface
|
||||
|
||||
if ($redis->connect($this->host, $this->port))
|
||||
{
|
||||
$service = new CacheDriver\RedisCache();
|
||||
$service->setRedis($redis);
|
||||
$this->cache = new CacheDriver\RedisCache();
|
||||
$this->cache->setRedis($redis);
|
||||
$this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../')));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new \Exception(sprintf("Redis instance with host '%s' and port '%s' is not reachable", $this->host, $this->port));
|
||||
}
|
||||
|
||||
$service->setNamespace(md5(realpath(__DIR__.'/../../../../../../')));
|
||||
}
|
||||
|
||||
return $service;
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
|
@@ -26,6 +26,8 @@ use Alchemy\Phrasea\Core,
|
||||
class XcacheCache extends ServiceAbstract implements ServiceInterface
|
||||
{
|
||||
|
||||
protected $cache;
|
||||
|
||||
public function getScope()
|
||||
{
|
||||
return 'cache';
|
||||
@@ -38,11 +40,14 @@ class XcacheCache extends ServiceAbstract implements ServiceInterface
|
||||
throw new \Exception('The XCache cache requires the XCache extension.');
|
||||
}
|
||||
|
||||
$service = new CacheDriver\XcacheCache();
|
||||
if (!$this->cache)
|
||||
{
|
||||
$this->cache = new CacheDriver\XcacheCache();
|
||||
|
||||
$service->setNamespace(md5(realpath(__DIR__.'/../../../../../../')));
|
||||
$this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../')));
|
||||
}
|
||||
|
||||
return $service;
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
@@ -55,5 +60,4 @@ class XcacheCache extends ServiceAbstract implements ServiceInterface
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
63
lib/Alchemy/Phrasea/Core/Service/Log/FirePHP.php
Normal file
63
lib/Alchemy/Phrasea/Core/Service/Log/FirePHP.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Service\Log;
|
||||
|
||||
use Alchemy\Phrasea\Core,
|
||||
Alchemy\Phrasea\Core\Service,
|
||||
Alchemy\Phrasea\Core\Service\ServiceAbstract,
|
||||
Alchemy\Phrasea\Core\Service\ServiceInterface;
|
||||
use Monolog\Logger;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\FirePHPHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class FirePHP extends ServiceAbstract implements ServiceInterface
|
||||
{
|
||||
|
||||
protected $logger;
|
||||
|
||||
public function __construct(\Alchemy\Phrasea\Core $core, $name, Array $options)
|
||||
{
|
||||
parent::__construct($core, $name, $options);
|
||||
|
||||
$this->logger = new Logger('FirePHP');
|
||||
|
||||
$this->logger->pushHandler(new FirePHPHandler());
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDriver()
|
||||
{
|
||||
return $this->logger;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return 'FirePHP Monolog';
|
||||
}
|
||||
|
||||
public function getScope()
|
||||
{
|
||||
return 'log';
|
||||
}
|
||||
|
||||
public static function getMandatoryOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
}
|
@@ -66,7 +66,7 @@ class Monolog extends ServiceAbstract implements ServiceInterface
|
||||
, $handler
|
||||
, $this->name
|
||||
, $this->getScope()
|
||||
, implode(", ", $this->handler)
|
||||
, implode(", ", $this->handlers)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@@ -17,8 +17,6 @@ use Alchemy\Phrasea\Core,
|
||||
Alchemy\Phrasea\Core\Service\ServiceInterface;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
||||
use Events\Listener\Cache\Action\Clear as ClearCacheListener;
|
||||
use Doctrine\ORM\Events as DoctrineEvents;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -54,33 +52,33 @@ class Doctrine extends ServiceAbstract implements ServiceInterface
|
||||
$config->setSQLLogger($this->getLog($logServiceName));
|
||||
}
|
||||
|
||||
//get cache
|
||||
$cache = isset($options["cache"]) ? $options["cache"] : false;
|
||||
|
||||
if (!$cache || $this->debug)
|
||||
{
|
||||
$metaCache = $this->core['CacheService']->get('ORMmetadata', 'Cache\\ArrayCache');
|
||||
$queryCache = $this->core['CacheService']->get('ORMquery', 'Cache\\ArrayCache');
|
||||
$resultCache = $this->core['CacheService']->get('ORMresult', 'Cache\\ArrayCache');
|
||||
// $resultCache = $this->core['CacheService']->get('ORMresult', 'Cache\\ArrayCache');
|
||||
}
|
||||
else
|
||||
{
|
||||
$query = isset($cache["query"]['service']) ? $cache["query"]['service'] : 'Cache\\ArrayCache';
|
||||
$meta = isset($cache["metadata"]['service']) ? $cache["metadata"]['service'] : 'Cache\\ArrayCache';
|
||||
$results = isset($cache["result"]['service']) ? $cache["result"]['service'] : 'Cache\\ArrayCache';
|
||||
// $results = isset($cache["result"]['service']) ? $cache["result"]['service'] : 'Cache\\ArrayCache';
|
||||
|
||||
$queryCache = $this->core['CacheService']->get('ORMquery', $query);
|
||||
$metaCache = $this->core['CacheService']->get('ORMmetadata', $meta);
|
||||
$resultCache = $this->core['CacheService']->get('ORMresult', $results);
|
||||
// $resultCache = $this->core['CacheService']->get('ORMresult', 'Cache\\ArrayCache');
|
||||
}
|
||||
|
||||
$resultCache = $this->core['CacheService']->get('ORMresult', 'Cache\\ArrayCache');
|
||||
|
||||
$config->setMetadataCacheImpl($metaCache->getDriver());
|
||||
|
||||
$config->setQueryCacheImpl($queryCache->getDriver());
|
||||
|
||||
$config->setResultCacheImpl($resultCache->getDriver());
|
||||
|
||||
|
||||
//define autoregeneration of proxies base on debug mode
|
||||
$config->setAutoGenerateProxyClasses($this->debug);
|
||||
|
||||
@@ -124,11 +122,6 @@ class Doctrine extends ServiceAbstract implements ServiceInterface
|
||||
|
||||
$evm->addEventSubscriber(new \Gedmo\Timestampable\TimestampableListener());
|
||||
|
||||
$evm->addEventListener(DoctrineEvents::postUpdate, new ClearCacheListener());
|
||||
$evm->addEventListener(DoctrineEvents::postRemove, new ClearCacheListener());
|
||||
$evm->addEventListener(DoctrineEvents::postPersist, new ClearCacheListener());
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
$this->entityManager = \Doctrine\ORM\EntityManager::create($dbalConf, $config, $evm);
|
||||
|
@@ -32,10 +32,13 @@ class Prod extends Helper
|
||||
);
|
||||
|
||||
$bases = $fields = $dates = array();
|
||||
$appbox = \appbox::get_instance($this->core);
|
||||
$session = $appbox->get_session();
|
||||
$user = $this->getCore()->getAuthenticatedUser();
|
||||
|
||||
if(!$user instanceof \User_Adapter)
|
||||
{
|
||||
return $search_datas;
|
||||
}
|
||||
|
||||
$searchSet = $user->getPrefs('search');
|
||||
|
||||
foreach ($user->ACL()->get_granted_sbas() as $databox)
|
||||
|
@@ -422,27 +422,6 @@ class Edit extends RecordHelper
|
||||
{
|
||||
$i = count($this->javascript_fields);
|
||||
|
||||
switch ($meta->get_type())
|
||||
{
|
||||
case 'datetime':
|
||||
$format = _('phraseanet::technique::datetime-edit-format');
|
||||
$explain = _('phraseanet::technique::datetime-edit-explain');
|
||||
break;
|
||||
case 'date':
|
||||
$format = _('phraseanet::technique::date-edit-format');
|
||||
$explain = _('phraseanet::technique::date-edit-explain');
|
||||
break;
|
||||
case 'time':
|
||||
$format = _('phraseanet::technique::time-edit-format');
|
||||
$explain = _('phraseanet::technique::time-edit-explain');
|
||||
break;
|
||||
default:
|
||||
$format = $explain = "";
|
||||
break;
|
||||
}
|
||||
|
||||
$regfield = ($meta->is_regname() || $meta->is_regdesc() || $meta->is_regdate());
|
||||
|
||||
$source = $meta->get_source();
|
||||
$separator = $meta->get_separator();
|
||||
|
||||
@@ -455,12 +434,11 @@ class Edit extends RecordHelper
|
||||
, 'required' => $meta->is_required()
|
||||
, 'readonly' => $meta->is_readonly()
|
||||
, 'type' => $meta->get_type()
|
||||
, 'format' => $format
|
||||
, 'explain' => $explain
|
||||
, 'format' => ''
|
||||
, 'explain' => ''
|
||||
, 'tbranch' => $meta->get_tbranch()
|
||||
, 'maxLength' => $source ? $source->maxlength() : 0
|
||||
, 'minLength' => $source ? $source->minLength() : 0
|
||||
, 'regfield' => $regfield
|
||||
, 'multi' => $meta->is_multi()
|
||||
, 'separator' => $separator
|
||||
, 'vocabularyControl' => $meta->getVocabularyControl() ? $meta->getVocabularyControl()->getType() : null
|
||||
@@ -615,55 +593,6 @@ class Edit extends RecordHelper
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
// foreach ($trecchanges as $fname => $fchange)
|
||||
// {
|
||||
// $bool = false;
|
||||
// if ($regfields && $parm['act_option'] == 'SAVEGRP'
|
||||
// && $fname == $regfields['regname'])
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// $basket = basket_adapter::getInstance($parm['ssel']);
|
||||
// $basket->name = implode(' ', $fchange['values']);
|
||||
// $basket->save();
|
||||
// $bool = true;
|
||||
// }
|
||||
// catch (Exception $e)
|
||||
// {
|
||||
// echo $e->getMessage();
|
||||
// }
|
||||
// }
|
||||
// if ($regfields && $parm['act_option'] == 'SAVEGRP'
|
||||
// && $fname == $regfields['regdesc'])
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// $basket = basket_adapter::getInstance($parm['ssel']);
|
||||
// $basket->desc = implode(' ', $fchange['values']);
|
||||
// $basket->save();
|
||||
// $bool = true;
|
||||
// }
|
||||
// catch (Exception $e)
|
||||
// {
|
||||
// echo $e->getMessage();
|
||||
// }
|
||||
// }
|
||||
// if ($bool)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// $basket = basket_adapter::getInstance($parm['ssel']);
|
||||
// $basket->delete_cache();
|
||||
// }
|
||||
// catch (Exception $e)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -131,10 +131,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
|
||||
sum(remain_dwnld) as remain_dwnld,
|
||||
sum(month_dwnld_max) as month_dwnld_max,
|
||||
|
||||
mask_xor as maskxordec,
|
||||
bin(mask_xor) as maskxorbin,
|
||||
mask_and as maskanddec,
|
||||
bin(mask_and) as maskandbin
|
||||
sum(mask_and + mask_xor) as masks
|
||||
|
||||
FROM (usr u, bas b, sbas s)
|
||||
LEFT JOIN (basusr bu)
|
||||
@@ -206,8 +203,6 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper
|
||||
{
|
||||
$this->base_id = (int) $this->request->get('base_id');
|
||||
|
||||
// $this->base_id = (int) $parm['base_id'];
|
||||
|
||||
$sql = "SELECT u.usr_id, restrict_dwnld, remain_dwnld, month_dwnld_max
|
||||
FROM (usr u INNER JOIN basusr bu ON u.usr_id = bu.usr_id)
|
||||
WHERE u.usr_id = " . implode(' OR u.usr_id = ', $this->users) . "
|
||||
|
@@ -184,8 +184,10 @@ class PDF
|
||||
$fimg = $subdef->get_pathfile();
|
||||
|
||||
if (!$user->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark")
|
||||
&& $subdef->get_type() == media_subdef::TYPE_IMAGE)
|
||||
$fimg = recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id());
|
||||
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE)
|
||||
{
|
||||
$fimg = \recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id());
|
||||
}
|
||||
|
||||
$wimg = $himg = $ImgSize;
|
||||
if ($subdef->get_height() > 0 && $subdef->get_width() > 0)
|
||||
@@ -479,8 +481,8 @@ class PDF
|
||||
$f = $subdef->get_pathfile();
|
||||
|
||||
if (!$user->ACL()->has_right_on_base($rec->get_base_id(), "nowatermark")
|
||||
&& $subdef->get_type() == media_subdef::TYPE_IMAGE)
|
||||
$f = recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id());
|
||||
&& $subdef->get_type() == \media_subdef::TYPE_IMAGE)
|
||||
$f = \recordutils_image::watermark($rec->get_base_id(), $rec->get_record_id());
|
||||
|
||||
$wimg = $himg = 150; // preview dans un carre de 150 mm
|
||||
if ($subdef->get_width() > 0 && $subdef->get_height() > 0)
|
||||
|
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Events\Listener\Cache\Action;
|
||||
|
||||
use Entities;
|
||||
use Doctrine\ORM\Event\LifecycleEventArgs, Doctrine\Common\Cache\Cache;
|
||||
use Events\Processor\Factory, Events\Processor\Factory\Exception as ProcessorNotFound;
|
||||
|
||||
/**
|
||||
* Clear event used to delete entries in cache
|
||||
*
|
||||
* @package
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class Clear
|
||||
{
|
||||
|
||||
public function postUpdate(LifecycleEventArgs $eventArgs)
|
||||
{
|
||||
$this->clear($eventArgs);
|
||||
}
|
||||
|
||||
public function postRemove(LifecycleEventArgs $eventArgs)
|
||||
{
|
||||
$this->clear($eventArgs);
|
||||
}
|
||||
|
||||
public function postPersist(LifecycleEventArgs $eventArgs)
|
||||
{
|
||||
$this->clear($eventArgs);
|
||||
}
|
||||
|
||||
private function clear(LifecycleEventArgs $eventArgs)
|
||||
{
|
||||
try
|
||||
{
|
||||
//get proper cache action processor for the processed entity
|
||||
$factory = new Factory\CacheAction(get_class($eventArgs->getEntity()));
|
||||
$factory->getProcessor()->process($eventArgs);
|
||||
}
|
||||
catch (ProcessorNotFound $e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Events\Processor\Cache\Action;
|
||||
|
||||
use Doctrine\Common\Cache;
|
||||
use Events\Processor\Processor;
|
||||
use Doctrine\Common\EventArgs;
|
||||
|
||||
/**
|
||||
*
|
||||
* @package
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
abstract class AbstractClear implements Processor
|
||||
{
|
||||
|
||||
/**
|
||||
* Return the current used result cache adapter
|
||||
* @param EventArgs $args
|
||||
* @return \Doctrine\Common\Cache
|
||||
*/
|
||||
protected function getCacheAdapter(EventArgs $args)
|
||||
{
|
||||
$em = $args->getEntityManager();
|
||||
|
||||
return $em->getConfiguration()->getResultCacheImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the processed entity cache suffix
|
||||
* @param EventArgs $args
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function getEntityCacheSuffix(EventArgs $args)
|
||||
{
|
||||
$entity = new \ReflectionClass(get_class($args->getEntity()));
|
||||
|
||||
if (!$entity->hasConstant("CACHE_SUFFIX"))
|
||||
{
|
||||
throw new \Exception(sprintf("Missing cache suffix for %s entity", $entity->getName()));
|
||||
}
|
||||
|
||||
return $entity->getConstant("CACHE_SUFFIX");
|
||||
}
|
||||
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Events\Processor\Cache\Action\Clear;
|
||||
|
||||
use Doctrine\Common\EventArgs;
|
||||
use Events\Processor\Cache\Action\AbstractClear;
|
||||
use Repositories\BasketRepository;
|
||||
use Entities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @package
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class Basket extends AbstractClear
|
||||
{
|
||||
|
||||
public function process(EventArgs $args)
|
||||
{
|
||||
$cache = $this->getCacheAdapter($args);
|
||||
$cache->deleteBySuffix(Entities\Basket::CACHE_SUFFIX);
|
||||
$cache->deleteBySuffix(Entities\BasketElement::CACHE_SUFFIX);
|
||||
}
|
||||
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Events\Processor\Cache\Action\Clear;
|
||||
|
||||
use Doctrine\Common\EventArgs;
|
||||
use Events\Processor\Cache\Action\AbstractClear;
|
||||
use Entities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @package
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class BasketElement extends AbstractClear
|
||||
{
|
||||
|
||||
public function process(EventArgs $args)
|
||||
{
|
||||
$cache = $this->getCacheAdapter($args);
|
||||
$cache->deleteBySuffix(Entities\Basket::CACHE_SUFFIX);
|
||||
$cache->deleteBySuffix(Entities\BasketElement::CACHE_SUFFIX);
|
||||
}
|
||||
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Events\Processor\Factory;
|
||||
|
||||
use Doctrine\Common\ClassLoader;
|
||||
|
||||
/**
|
||||
*
|
||||
* @package
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
|
||||
class CacheAction extends FactoryAbstract
|
||||
{
|
||||
public static function create($processor)
|
||||
{
|
||||
$entity = ucfirst(array_pop(explode("\\", $processor)));
|
||||
$className = sprintf("Events\Processor\Cache\Action\Clear\%s", $entity);
|
||||
|
||||
if(!class_exists($className))
|
||||
{
|
||||
throw new Exception(sprintf("Unknow processor %s", $processor));
|
||||
}
|
||||
|
||||
return new $className();
|
||||
}
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Events\Processor\Factory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @package
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
abstract class FactoryAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Events\Processor\Processor
|
||||
*/
|
||||
private $processor;
|
||||
|
||||
public function __construct($processor)
|
||||
{
|
||||
$this->processor = static::create($processor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Events\Processor\Processor
|
||||
*/
|
||||
public function getProcessor()
|
||||
{
|
||||
return $this->processor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function which create the proper processor
|
||||
* @param type $element
|
||||
* @throws \Exception
|
||||
*/
|
||||
abstract public static function create($processor);
|
||||
|
||||
}
|
||||
|
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Events\Processor;
|
||||
|
||||
use Doctrine\Common\EventArgs;
|
||||
|
||||
/**
|
||||
*
|
||||
* @package
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
interface Processor
|
||||
{
|
||||
|
||||
/**
|
||||
* The executed process for clearing cache
|
||||
* @return void
|
||||
*/
|
||||
public function process(EventArgs $args);
|
||||
}
|
@@ -35,8 +35,8 @@ class BasketElementRepository extends EntityRepository
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters($params);
|
||||
|
||||
$cacheId = "_user_basket_element_" . $element_id . "_" . $user->get_id() . Entities\BasketElement::CACHE_SUFFIX;
|
||||
$query->useResultCache(true, 1800, $cacheId);
|
||||
// $cacheId = "_user_basket_element_" . $element_id . "_" . $user->get_id() . Entities\BasketElement::CACHE_SUFFIX;
|
||||
// $query->useResultCache(true, 1800, $cacheId);
|
||||
|
||||
$element = $query->getOneOrNullResult();
|
||||
|
||||
@@ -66,8 +66,9 @@ class BasketElementRepository extends EntityRepository
|
||||
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters($params);
|
||||
$cacheId = "_basket_element_by_record_" . $record->get_serialize_key() . Entities\BasketElement::CACHE_SUFFIX;
|
||||
$query->useResultCache(true, 1800, $cacheId);
|
||||
|
||||
// $cacheId = "_basket_element_by_record_" . $record->get_serialize_key() . Entities\BasketElement::CACHE_SUFFIX;
|
||||
// $query->useResultCache(true, 1800, $cacheId);
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
@@ -98,8 +99,9 @@ class BasketElementRepository extends EntityRepository
|
||||
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters($params);
|
||||
$cacheId = "_receveid_element_by_record_" . $record->get_serialize_key() . "_" . $user->getId() . Entities\BasketElement::CACHE_SUFFIX;
|
||||
$query->useResultCache(true, 1800, $cacheId);
|
||||
|
||||
// $cacheId = "_receveid_element_by_record_" . $record->get_serialize_key() . "_" . $user->getId() . Entities\BasketElement::CACHE_SUFFIX;
|
||||
// $query->useResultCache(true, 1800, $cacheId);
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
@@ -123,8 +125,9 @@ class BasketElementRepository extends EntityRepository
|
||||
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters($params);
|
||||
$cacheId = "_receveid_validation_element_by_record" . $record->get_serialize_key() . "_" . $user->getId() . Entities\BasketElement::CACHE_SUFFIX;
|
||||
$query->useResultCache(true, 1800, $cacheId);
|
||||
|
||||
// $cacheId = "_receveid_validation_element_by_record" . $record->get_serialize_key() . "_" . $user->getId() . Entities\BasketElement::CACHE_SUFFIX;
|
||||
// $query->useResultCache(true, 1800, $cacheId);
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
|
@@ -56,9 +56,9 @@ class BasketRepository extends EntityRepository
|
||||
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters(array('usr_id' => $user->get_id()));
|
||||
$idCache = "_active_by_user_" . ($sort === null ? "" : $sort ) . "_" . $user->get_id() . Entities\Basket::CACHE_SUFFIX;
|
||||
|
||||
$query->useResultCache(true, 1800, $idCache);
|
||||
// $idCache = "_active_by_user_" . ($sort === null ? "" : $sort. "_" ) . $user->get_id() . Entities\Basket::CACHE_SUFFIX;
|
||||
// $query->useResultCache(true, 1800, $idCache);
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
@@ -79,9 +79,11 @@ class BasketRepository extends EntityRepository
|
||||
WHERE b.archived = false
|
||||
AND (
|
||||
(b.usr_id = :usr_id_owner AND b.is_read = false)
|
||||
OR (b.usr_id != :usr_id_ownertwo AND p.usr_id = :usr_id_participant
|
||||
OR (b.usr_id != :usr_id_ownertwo
|
||||
AND p.usr_id = :usr_id_participant
|
||||
AND p.is_aware = false)
|
||||
)
|
||||
AND (s.expires IS NULL OR s.expires > CURRENT_TIMESTAMP())
|
||||
ORDER BY e.ord ASC';
|
||||
|
||||
$params = array(
|
||||
@@ -93,9 +95,8 @@ class BasketRepository extends EntityRepository
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters($params);
|
||||
|
||||
$idCache = "findUnreadActiveByUser" . $user->get_id() . Entities\Basket::CACHE_SUFFIX;
|
||||
|
||||
$query->useResultCache(true, 1800, $idCache);
|
||||
// $idCache = "findUnreadActiveByUser" . $user->get_id() . Entities\Basket::CACHE_SUFFIX;
|
||||
// $query->useResultCache(true, 1800, $idCache);
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
@@ -129,8 +130,9 @@ class BasketRepository extends EntityRepository
|
||||
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters(array(1 => $user->get_id(), 2 => $user->get_id()));
|
||||
$idCache = "_active_validation_by_user_" . $user->get_id() . "_" . $sort . Entities\Basket::CACHE_SUFFIX;
|
||||
$query->useResultCache(true, 1800, $idCache);
|
||||
|
||||
// $idCache = "_active_validation_by_user_" . $user->get_id() . "_" . $sort . Entities\Basket::CACHE_SUFFIX;
|
||||
// $query->useResultCache(true, 1800, $idCache);
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
@@ -157,8 +159,9 @@ class BasketRepository extends EntityRepository
|
||||
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters(array('basket_id' => $basket_id));
|
||||
$cacheId = "_find_user_" . $basket_id . Entities\Basket::CACHE_SUFFIX;
|
||||
$query->useResultCache(true, 1800, $cacheId);
|
||||
|
||||
// $cacheId = "_find_user_" . $basket_id . Entities\Basket::CACHE_SUFFIX;
|
||||
// $query->useResultCache(true, 1800, $cacheId);
|
||||
|
||||
$basket = $query->getOneOrNullResult();
|
||||
|
||||
@@ -211,8 +214,9 @@ class BasketRepository extends EntityRepository
|
||||
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters($params);
|
||||
$idCache = "_containing_record_" . $record->get_serialize_key() . Entities\Basket::CACHE_SUFFIX;
|
||||
$query->useResultCache(true, 1800, $idCache);
|
||||
|
||||
// $idCache = "_containing_record_" . $record->get_serialize_key() . Entities\Basket::CACHE_SUFFIX;
|
||||
// $query->useResultCache(true, 1800, $idCache);
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
@@ -255,10 +259,9 @@ class BasketRepository extends EntityRepository
|
||||
);
|
||||
break;
|
||||
default:
|
||||
$type = 'default';
|
||||
$dql = 'SELECT b, e, s, p
|
||||
FROM Entities\Basket b
|
||||
JOIN b.elements e
|
||||
LEFT JOIN b.elements e
|
||||
LEFT JOIN b.validation s
|
||||
LEFT JOIN s.participants p
|
||||
WHERE (b.usr_id = :usr_id OR p.usr_id = :validating_usr_id)';
|
||||
@@ -267,6 +270,17 @@ class BasketRepository extends EntityRepository
|
||||
'validating_usr_id' => $user->get_id()
|
||||
);
|
||||
break;
|
||||
case self::MYBASKETS:
|
||||
$dql = 'SELECT b, e, s, p
|
||||
FROM Entities\Basket b
|
||||
LEFT JOIN b.elements e
|
||||
LEFT JOIN b.validation s
|
||||
LEFT JOIN s.participants p
|
||||
WHERE (b.usr_id = :usr_id)';
|
||||
$params = array(
|
||||
'usr_id' => $user->get_id()
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctype_digit($year) && strlen($year) == 4)
|
||||
@@ -285,7 +299,7 @@ class BasketRepository extends EntityRepository
|
||||
$params['description'] = '%' . $query . '%';
|
||||
}
|
||||
|
||||
$dql .= ' ORDER BY e.ord ASC';
|
||||
$dql .= ' ORDER BY b.id DESC, e.ord ASC';
|
||||
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters($params);
|
||||
@@ -293,12 +307,44 @@ class BasketRepository extends EntityRepository
|
||||
$count = Paginate::getTotalQueryResults($query);
|
||||
$paginateQuery = Paginate::getPaginateQuery($query, $offset, $perPage);
|
||||
|
||||
$idCache = "_" . $type . "_workzone_basket_" . $user->get_id() . Entities\Basket::CACHE_SUFFIX;
|
||||
// $idCache = "_" . $type . "_workzone_basket_" . $user->get_id() . Entities\Basket::CACHE_SUFFIX;
|
||||
// $paginateQuery->useResultCache(true, 1800, $idCache);
|
||||
|
||||
$paginateQuery->useResultCache(true, 1800, $idCache);
|
||||
$result = $paginateQuery->getResult();
|
||||
|
||||
return array('count' => $count, 'result' => $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all actives validation where current user is involved and user basket
|
||||
* @param \User_Adapter $user
|
||||
* @param type $sort
|
||||
* @return Array
|
||||
*/
|
||||
public function findActiveValidationAndBasketByUser(\User_Adapter $user, $sort = null)
|
||||
{
|
||||
$dql = 'SELECT b, e, s, p
|
||||
FROM Entities\Basket b
|
||||
LEFT JOIN b.elements e
|
||||
LEFT JOIN b.validation s
|
||||
LEFT JOIN s.participants p
|
||||
WHERE (b.usr_id = :usr_id
|
||||
AND b.archived = false) OR (b.usr_id != :usr_id AND p.usr_id = :usr_id
|
||||
AND (s.expires IS NULL OR s.expires > CURRENT_TIMESTAMP()))';
|
||||
|
||||
if ($sort == 'date')
|
||||
{
|
||||
$dql .= ' ORDER BY b.created DESC, e.ord ASC';
|
||||
}
|
||||
elseif ($sort == 'name')
|
||||
{
|
||||
$dql .= ' ORDER BY b.name ASC, e.ord ASC';
|
||||
}
|
||||
|
||||
$query = $this->_em->createQuery($dql);
|
||||
$query->setParameters(array('usr_id' => $user->get_id()));
|
||||
|
||||
return $query->getResult();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -44,7 +44,25 @@ class StoryWZRepository extends EntityRepository
|
||||
|
||||
if ($sort == 'name')
|
||||
{
|
||||
uasort($stories, array('\\Repositories\\StoryWZRepository', 'title_compare'));
|
||||
$sortedStories = array();
|
||||
foreach ($stories as $story)
|
||||
{
|
||||
$sortedStories[] = $story->getRecord()->get_title();
|
||||
}
|
||||
|
||||
uasort($sortedStories, function($a, $b)
|
||||
{
|
||||
if ($a == $b)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ($a < $b) ? -1 : 1;
|
||||
});
|
||||
|
||||
foreach ($sortedStories as $idStory => $titleStory)
|
||||
{
|
||||
$sortedStories[$idStory] = $stories[$idStory];
|
||||
}
|
||||
}
|
||||
|
||||
return $stories;
|
||||
@@ -54,7 +72,7 @@ class StoryWZRepository extends EntityRepository
|
||||
{
|
||||
$story = $this->find($id);
|
||||
|
||||
if($story)
|
||||
if ($story)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -66,7 +84,7 @@ class StoryWZRepository extends EntityRepository
|
||||
throw new \Exception_NotFound('Story not found');
|
||||
}
|
||||
|
||||
if($story->getUser()->get_id() !== $user->get_id())
|
||||
if ($story->getUser()->get_id() !== $user->get_id())
|
||||
{
|
||||
throw new \Exception_Forbidden('You have not access to ths story');
|
||||
}
|
||||
@@ -79,16 +97,6 @@ class StoryWZRepository extends EntityRepository
|
||||
return $story;
|
||||
}
|
||||
|
||||
protected static function title_compare(\Entities\StoryWZ $a, \Entities\StoryWZ $b)
|
||||
{
|
||||
if ($a->getRecord()->get_title() == $b->getRecord()->get_title())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ($a->getRecord()->get_title() < $b->getRecord()->get_title()) ? -1 : 1;
|
||||
}
|
||||
|
||||
public function findUserStory(\User_Adapter $user, \record_adapter $Story)
|
||||
{
|
||||
$story = $this->findOneBy(
|
||||
|
@@ -204,6 +204,25 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function caption_records(Request $request, $databox_id, $record_id)
|
||||
{
|
||||
$result = new API_V1_result($request, $this);
|
||||
|
||||
$record = $this->appbox->get_databox($databox_id)->get_record($record_id);
|
||||
$fields = $record->get_caption()->get_fields();
|
||||
$ret = array();
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
$ret[$field->get_meta_struct_id()] = array(
|
||||
'meta_structure_id' => $field->get_meta_struct_id()
|
||||
, 'name' => $field->get_name()
|
||||
, 'value' => $field->get_serialized_values(";")
|
||||
);
|
||||
}
|
||||
$result->set_datas($ret);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an API_V1_result containing the results of a records search
|
||||
*
|
||||
|
@@ -131,4 +131,18 @@ class Bridge_Api_Dailymotion_Container implements Bridge_Api_ContainerInterface
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function get_duration()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function get_category()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function is_private()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -138,4 +138,19 @@ class Bridge_Api_Flickr_Container implements Bridge_Api_ContainerInterface
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
|
||||
public function get_duration()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function get_category()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function is_private()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -210,7 +210,7 @@ class Bridge_Api_Flickr_Element implements Bridge_Api_ElementInterface
|
||||
*/
|
||||
public function get_category()
|
||||
{
|
||||
return null;
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,7 +219,7 @@ class Bridge_Api_Flickr_Element implements Bridge_Api_ElementInterface
|
||||
*/
|
||||
public function get_duration()
|
||||
{
|
||||
return null;
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,5 +279,4 @@ class Bridge_Api_Flickr_Element implements Bridge_Api_ElementInterface
|
||||
{
|
||||
return $this->entry["tags"];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -117,4 +117,20 @@ class Bridge_Api_Youtube_Container implements Bridge_Api_ContainerInterface
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function get_duration()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
public function get_category()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
public function is_private()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -558,7 +558,7 @@ class Session_Handler
|
||||
$browser = Browser::getInstance();
|
||||
|
||||
if($this->is_authenticated())
|
||||
$user = User_Adapter::getInstance ($this->get_usr_id (), appbox::get_instance ());
|
||||
$user = User_Adapter::getInstance ($this->get_usr_id (), appbox::get_instance (\bootstrap::getCore()));
|
||||
|
||||
return Session_Logger::create($databox, $browser, $this, $user);
|
||||
}
|
||||
|
@@ -456,15 +456,6 @@ class appbox extends base
|
||||
|
||||
$cacheService = "array_cache";
|
||||
|
||||
if (extension_loaded('apc'))
|
||||
{
|
||||
$cacheService = "apc_cache";
|
||||
}
|
||||
elseif (extension_loaded('xcache'))
|
||||
{
|
||||
$cacheService = "xcache_cache";
|
||||
}
|
||||
|
||||
$Core->getConfiguration()->setConnexions($connexion);
|
||||
|
||||
$services = $Core->getConfiguration()->getConfigurations();
|
||||
@@ -474,7 +465,7 @@ class appbox extends base
|
||||
if ($serviceName === "doctrine_prod")
|
||||
{
|
||||
|
||||
$services["doctrine_prod"]["options"]["orm"]["cache"] = array(
|
||||
$services["doctrine_prod"]["options"]["cache"] = array(
|
||||
"query" => $cacheService,
|
||||
"result" => $cacheService,
|
||||
"metadata" => $cacheService
|
||||
|
@@ -60,6 +60,7 @@ abstract class base implements cache_cacheableInterface
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
const APPLICATION_BOX = 'APPLICATION_BOX';
|
||||
/**
|
||||
*
|
||||
@@ -78,7 +79,6 @@ abstract class base implements cache_cacheableInterface
|
||||
public function get_schema()
|
||||
{
|
||||
if ($this->schema)
|
||||
|
||||
return $this->schema;
|
||||
|
||||
$this->load_schema();
|
||||
@@ -178,7 +178,7 @@ abstract class base implements cache_cacheableInterface
|
||||
public function get_data_from_cache($option = null)
|
||||
{
|
||||
|
||||
if($this->get_base_type() == self::DATA_BOX)
|
||||
if ($this->get_base_type() == self::DATA_BOX)
|
||||
{
|
||||
\cache_databox::refresh($this->id);
|
||||
}
|
||||
@@ -232,7 +232,6 @@ abstract class base implements cache_cacheableInterface
|
||||
{
|
||||
|
||||
if ($this->version)
|
||||
|
||||
return $this->version;
|
||||
|
||||
$version = '0.0.0';
|
||||
@@ -261,10 +260,8 @@ abstract class base implements cache_cacheableInterface
|
||||
public function upgradeavailable()
|
||||
{
|
||||
if ($this->get_version())
|
||||
|
||||
return version_compare(\Alchemy\Phrasea\Core\Version::getNumber(), $this->get_version(), '>');
|
||||
else
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -288,6 +285,18 @@ abstract class base implements cache_cacheableInterface
|
||||
$stmt->closeCursor();
|
||||
|
||||
|
||||
$ORMTables = array(
|
||||
'BasketElements',
|
||||
'Baskets',
|
||||
'StoryWZ',
|
||||
'UsrListOwners',
|
||||
'UsrLists',
|
||||
'UsrListsContent',
|
||||
'ValidationDatas',
|
||||
'ValidationParticipants',
|
||||
'ValidationSessions',
|
||||
);
|
||||
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
$tname = $row["Name"];
|
||||
@@ -322,7 +331,7 @@ abstract class base implements cache_cacheableInterface
|
||||
unset($allTables[$tname]);
|
||||
$upgrader->add_steps_complete(1);
|
||||
}
|
||||
else
|
||||
elseif (!in_array($tname, $ORMTables))
|
||||
{
|
||||
$recommends[] = array(
|
||||
'message' => 'Une table pourrait etre supprime',
|
||||
@@ -390,7 +399,6 @@ abstract class base implements cache_cacheableInterface
|
||||
protected function load_schema()
|
||||
{
|
||||
if ($this->schema)
|
||||
|
||||
return $this;
|
||||
|
||||
$structure = simplexml_load_file(__DIR__ . "/../../lib/conf.d/bases_structure.xml");
|
||||
|
@@ -50,10 +50,6 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
||||
$this->record = $record;
|
||||
$this->databox = $databox;
|
||||
|
||||
|
||||
$this->retrieve_fields();
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -182,7 +178,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
||||
protected function highlight_fields($highlight, Array $grep_fields = null, searchEngine_adapter $searchEngine = null)
|
||||
{
|
||||
$fields = array();
|
||||
foreach ($this->fields as $meta_struct_id => $field)
|
||||
foreach ($this->retrieve_fields() as $meta_struct_id => $field)
|
||||
{
|
||||
if (is_array($grep_fields) && !in_array($field->get_name(), $grep_fields))
|
||||
continue;
|
||||
|
@@ -991,13 +991,6 @@ class databox extends base
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (isset($field['regname']))
|
||||
$meta_struct_field->set_regname();
|
||||
if (isset($field['regdate']))
|
||||
$meta_struct_field->set_regdate();
|
||||
if (isset($field['regdesc']))
|
||||
$meta_struct_field->set_regdesc();
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@@ -98,24 +98,6 @@ class databox_field implements cache_cacheableInterface
|
||||
*/
|
||||
protected $thumbtitle;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var <type>
|
||||
*/
|
||||
protected $regdate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var <type>
|
||||
*/
|
||||
protected $regdesc;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var <type>
|
||||
*/
|
||||
protected $regname;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var int
|
||||
@@ -163,7 +145,7 @@ class databox_field implements cache_cacheableInterface
|
||||
|
||||
$connbas = $this->get_connection();
|
||||
|
||||
$sql = "SELECT `regdate`, `regdesc`, `regname`, `thumbtitle`, `separator`
|
||||
$sql = "SELECT `thumbtitle`, `separator`
|
||||
, `dces_element`, `tbranch`, `type`, `report`, `multi`, `required`
|
||||
, `readonly`, `indexable`, `name`, `src`
|
||||
, `VocabularyControlType`, `RestrictToVocabularyControl`
|
||||
@@ -216,10 +198,6 @@ class databox_field implements cache_cacheableInterface
|
||||
$this->separator = $separator;
|
||||
$this->thumbtitle = $row['thumbtitle'];
|
||||
|
||||
$this->regdesc = !!$row['regdesc'];
|
||||
$this->regname = !!$row['regname'];
|
||||
$this->regdate = !!$row['regdate'];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -621,39 +599,6 @@ class databox_field implements cache_cacheableInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return databox_field
|
||||
*/
|
||||
public function set_regdate()
|
||||
{
|
||||
$this->set_reg_attr('date');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return databox_field
|
||||
*/
|
||||
public function set_regdesc()
|
||||
{
|
||||
$this->set_reg_attr('desc');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return databox_field
|
||||
*/
|
||||
public function set_regname()
|
||||
{
|
||||
$this->set_reg_attr('name');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $attr
|
||||
@@ -683,33 +628,6 @@ class databox_field implements cache_cacheableInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_regname()
|
||||
{
|
||||
return $this->regname;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_regdesc()
|
||||
{
|
||||
return $this->regdesc;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_regdate()
|
||||
{
|
||||
return $this->regdate;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
@@ -870,10 +788,10 @@ class databox_field implements cache_cacheableInterface
|
||||
|
||||
$sql = "INSERT INTO metadatas_structure
|
||||
(`id`, `name`, `src`, `readonly`, `indexable`, `type`, `tbranch`,
|
||||
`thumbtitle`, `multi`, `regname`, `regdesc`, `regdate` ,
|
||||
`thumbtitle`, `multi`,
|
||||
`report`, `sorter`)
|
||||
VALUES (null, :name, '', 0, 1, 'text', '',
|
||||
null, 0, null, null, null,
|
||||
null, 0,
|
||||
1, :sorter)";
|
||||
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
|
177
lib/classes/eventsmanager/notify/downloadmailfail.class.php
Normal file
177
lib/classes/eventsmanager/notify/downloadmailfail.class.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 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 eventsmanager_notify_downloadmailfail extends eventsmanager_notifyAbstract
|
||||
{
|
||||
|
||||
const MAIL_NO_VALID = 1;
|
||||
const MAIL_FAIL = 2;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $events = array('__EXPORT_MAIL_FAIL__');
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function icon_url()
|
||||
{
|
||||
return '/skins/icons/user.png';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $event
|
||||
* @param Array $params
|
||||
* @param mixed content $object
|
||||
* @return Void
|
||||
*/
|
||||
public function fire($event, $params, &$object)
|
||||
{
|
||||
$default = array(
|
||||
'usr_id' => null
|
||||
, 'lst' => ''
|
||||
, 'ssttid' => ''
|
||||
, 'dest' => ''
|
||||
, 'reason' => ''
|
||||
);
|
||||
|
||||
$params = array_merge($default, $params);
|
||||
|
||||
$dom_xml = new DOMDocument('1.0', 'UTF-8');
|
||||
$dom_xml->preserveWhiteSpace = false;
|
||||
$dom_xml->formatOutput = true;
|
||||
|
||||
$root = $dom_xml->createElement('datas');
|
||||
|
||||
$lst = $dom_xml->createElement('lst');
|
||||
$ssttid = $dom_xml->createElement('ssttid');
|
||||
$dest = $dom_xml->createElement('dest');
|
||||
$reason = $dom_xml->createElement('reason');
|
||||
|
||||
$lst->appendChild($dom_xml->createTextNode($params['lst']));
|
||||
$ssttid->appendChild($dom_xml->createTextNode($params['ssttid']));
|
||||
$dest->appendChild($dom_xml->createTextNode($params['dest']));
|
||||
$reason->appendChild($dom_xml->createTextNode($params['reason']));
|
||||
|
||||
$root->appendChild($lst);
|
||||
$root->appendChild($ssttid);
|
||||
$root->appendChild($dest);
|
||||
$root->appendChild($reason);
|
||||
|
||||
$dom_xml->appendChild($root);
|
||||
|
||||
$datas = $dom_xml->saveXml();
|
||||
|
||||
$mailed = false;
|
||||
|
||||
$send_notif = ($this->get_prefs(__CLASS__, $params['usr_id']) != '0');
|
||||
|
||||
if ($send_notif)
|
||||
{
|
||||
$user = User_Adapter::getInstance($params['usr_id'], $this->appbox);
|
||||
$name = $user->get_display_name();
|
||||
|
||||
$to = array('email' => $user->get_email(), 'name' => $name);
|
||||
|
||||
$from = array(
|
||||
'email' => $this->registry->get('GV_defaulmailsenderaddr'),
|
||||
'name' => $this->registry->get('GV_homeTitle')
|
||||
);
|
||||
|
||||
if (parent::email())
|
||||
$mailed = true;
|
||||
}
|
||||
|
||||
$this->broker->notify($params['usr_id'], __CLASS__, $datas, $mailed);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Array $datas
|
||||
* @param boolean $unread
|
||||
* @return Array
|
||||
*/
|
||||
public function datas($datas, $unread)
|
||||
{
|
||||
$sx = simplexml_load_string($datas);
|
||||
$usr_id = (int) $sx->usr_id;
|
||||
$reason = (int) $sx->reason;
|
||||
$lst = (string) $sx->lst;
|
||||
$ssttid = (int) $sx->ssttid;
|
||||
$dest = (string) $sx->dest;
|
||||
|
||||
if ($reason == self::MAIL_NO_VALID)
|
||||
{
|
||||
$reason = _('email is not valid');
|
||||
}
|
||||
elseif ($reason == self::MAIL_FAIL)
|
||||
{
|
||||
$reason = _('failed to send mail');
|
||||
}
|
||||
else
|
||||
{
|
||||
$reason = _('an error occured while exporting records');
|
||||
}
|
||||
|
||||
$text = sprintf(
|
||||
_("The delivery to %s failed for the following reason : %s")
|
||||
, $dest
|
||||
, $reason
|
||||
);
|
||||
|
||||
$ret = array(
|
||||
'text' => $text
|
||||
, 'class' => ''
|
||||
);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_name()
|
||||
{
|
||||
return _('Email export fails');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_description()
|
||||
{
|
||||
return _('Get a notification when a mail export fails');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
function is_available()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@@ -208,8 +208,9 @@ class mail
|
||||
|
||||
$body = eregi_replace("[\]", '', $body);
|
||||
|
||||
$body .= "<br/>\n"._('Si le lien n\'est pas cliquable, copiez-collez le dans votre navigateur.')."<br/>\n";
|
||||
$body .= "<br/><br/><br/><br/>\n\n\n\n";
|
||||
$body .= '<div style="font-style:italic;">'._('si cet email contient des liens non cliquables copiez/collez ces liens dans votre navigateur.').'</div>';
|
||||
$body .= "<br/>\n";
|
||||
$body .= '<div style="font-style:italic;">' . _('phraseanet::signature automatique des notifications par mail, infos a l\'url suivante') . "</div>\n";
|
||||
$body .= '<div><a href="' . $registry->get('GV_ServerName') . '">' . $registry->get('GV_ServerName') . "</a></div>\n";
|
||||
$body = '<body>' . $body . '</body>';
|
||||
@@ -258,7 +259,7 @@ class mail
|
||||
$mail->ConfirmReadingTo = $reading_confirm_to;
|
||||
}
|
||||
|
||||
$mail->MsgHTML(strip_tags($body, '<div><br><ul><li>'));
|
||||
$mail->MsgHTML(strip_tags($body, '<div><br><ul><li><em><strong><span><br>'));
|
||||
|
||||
foreach ($files as $f)
|
||||
{
|
||||
|
@@ -143,7 +143,7 @@ class module_console_fileConfigCheck extends Command
|
||||
private function checkParse(OutputInterface $output)
|
||||
{
|
||||
|
||||
if (!$this->configuration->getConfigurations())
|
||||
if (!$this->configuration)
|
||||
{
|
||||
throw new \Exception("Unable to load configurations\n");
|
||||
}
|
||||
@@ -163,7 +163,7 @@ class module_console_fileConfigCheck extends Command
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->configuration->getConfiguration();
|
||||
$this->configuration;
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
@@ -178,15 +178,8 @@ class module_console_fileConfigCheck extends Command
|
||||
{
|
||||
$configuration = Core\Configuration::build();
|
||||
|
||||
try
|
||||
{
|
||||
$configuration->getConfiguration();
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
throw new \Exception(sprintf("Check get selected environment from file\n"), null, $e);
|
||||
}
|
||||
$output->writeln("<info>Get Selected Environment from file OK</info>");
|
||||
$env = $configuration->getEnvironnement();
|
||||
$output->writeln("<info>Get Selected Environment from file : ".$env."</info>");
|
||||
|
||||
return;
|
||||
}
|
||||
|
920
lib/classes/module/console/fileEnsureDevSetting.class.php
Normal file
920
lib/classes/module/console/fileEnsureDevSetting.class.php
Normal file
@@ -0,0 +1,920 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument,
|
||||
Symfony\Component\Console\Input\InputInterface,
|
||||
Symfony\Component\Console\Input\InputOption,
|
||||
Symfony\Component\Console\Output\OutputInterface,
|
||||
Symfony\Component\Console\Command\Command;
|
||||
use Alchemy\Phrasea\Core;
|
||||
use Symfony\Component\Yaml;
|
||||
|
||||
/**
|
||||
* @todo write tests
|
||||
*
|
||||
* @package
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class module_console_fileEnsureDevSetting extends Command
|
||||
{
|
||||
|
||||
const ALERT = 1;
|
||||
const ERROR = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var \Alchemy\Phrasea\Core\Configuration
|
||||
*/
|
||||
protected $configuration;
|
||||
protected $testSuite = array(
|
||||
'checkPhraseanetScope'
|
||||
, 'checkDatabaseScope'
|
||||
, 'checkTeamplateEngineService'
|
||||
, 'checkOrmService'
|
||||
, 'checkCacheService'
|
||||
, 'checkOpcodeCacheService'
|
||||
);
|
||||
protected $errors = 0;
|
||||
protected $alerts = 0;
|
||||
|
||||
public function __construct($name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
|
||||
$this->setDescription('Ensure development settings');
|
||||
|
||||
$this->addArgument('conf', InputArgument::OPTIONAL, 'The file to check', null);
|
||||
$this->addOption('strict', 's', InputOption::VALUE_NONE, 'Wheter to fail on alerts or not');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$specifications = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();
|
||||
|
||||
$environnement = $input->getArgument('conf');
|
||||
|
||||
$this->configuration = \Alchemy\Phrasea\Core\Configuration::build($specifications, $environnement);
|
||||
|
||||
if (!$this->configuration->isInstalled())
|
||||
{
|
||||
$output->writeln(sprintf("\nPhraseanet is not installed\n"));
|
||||
}
|
||||
|
||||
$this->checkParse($output);
|
||||
$output->writeln(sprintf("Will Ensure Production Settings on <info>%s</info>", $this->configuration->getEnvironnement()));
|
||||
|
||||
$this->runTests($output);
|
||||
|
||||
$retval = $this->errors;
|
||||
if ($input->getOption('strict'))
|
||||
{
|
||||
$retval += $this->alerts;
|
||||
}
|
||||
|
||||
if ($retval > 0)
|
||||
{
|
||||
$output->writeln("\n<error>Some errors found in your conf</error>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$output->writeln("\n<info>Your dev settings are setted correctly ! Enjoy</info>");
|
||||
}
|
||||
$output->writeln('End');
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
private function runTests(OutputInterface $output)
|
||||
{
|
||||
foreach ($this->testSuite as $test)
|
||||
{
|
||||
$display = "";
|
||||
switch ($test)
|
||||
{
|
||||
case 'checkPhraseanetScope' :
|
||||
$display = "Phraseanet Configuration";
|
||||
break;
|
||||
case 'checkDatabaseScope' :
|
||||
$display = "Database";
|
||||
break;
|
||||
case 'checkTeamplateEngineService' :
|
||||
$display = "Template Engine";
|
||||
break;
|
||||
case 'checkOrmService' :
|
||||
$display = "ORM";
|
||||
break;
|
||||
case 'checkCacheService' :
|
||||
$display = "Cache";
|
||||
break;
|
||||
case 'checkOpcodeCacheService' :
|
||||
$display = "Opcode";
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('Unknown test');
|
||||
break;
|
||||
}
|
||||
|
||||
$output->writeln(sprintf("\n||| %s", mb_strtoupper($display)));
|
||||
|
||||
call_user_func(array($this, $test), $output);
|
||||
}
|
||||
}
|
||||
|
||||
private function checkParse(OutputInterface $output)
|
||||
{
|
||||
|
||||
if (!$this->configuration->getConfigurations())
|
||||
{
|
||||
throw new \Exception("Unable to load configurations\n");
|
||||
}
|
||||
if (!$this->configuration->getConnexions())
|
||||
{
|
||||
throw new \Exception("Unable to load connexions\n");
|
||||
}
|
||||
if (!$this->configuration->getServices())
|
||||
{
|
||||
throw new \Exception("Unable to load services\n");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private function checkCacheService(OutputInterface $output)
|
||||
{
|
||||
$cache = $this->configuration->getCache();
|
||||
|
||||
|
||||
if ($this->probeCacheService($output, $cache))
|
||||
{
|
||||
if ($this->recommendedCacheService($output, $cache, true))
|
||||
{
|
||||
$work_message = '<info>Works !</info>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$work_message = '<comment>Cache server recommended</comment>';
|
||||
$this->alerts++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$work_message = '<error>Failed - could not connect !</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$verification = sprintf("\t--> Verify <info>%s</info> : %s", 'MainCache', $work_message);
|
||||
|
||||
|
||||
$this->printConf($output, "\t" . 'service', $cache, false, $verification);
|
||||
$this->verifyCacheOptions($output, $cache);
|
||||
}
|
||||
|
||||
private function checkOpcodeCacheService(OutputInterface $output)
|
||||
{
|
||||
$cache = $this->configuration->getOpcodeCache();
|
||||
|
||||
|
||||
if ($this->probeCacheService($output, $cache))
|
||||
{
|
||||
if ($this->recommendedCacheService($output, $cache, false))
|
||||
{
|
||||
$work_message = '<info>Works !</info>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$work_message = '<error>No cache required</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$work_message = '<error>Failed - could not connect !</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$verification = sprintf("\t--> Verify <info>%s</info> : %s", 'OpcodeCache', $work_message);
|
||||
|
||||
|
||||
$this->printConf($output, "\t" . 'service', $cache, false, $verification);
|
||||
$this->verifyCacheOptions($output, $cache);
|
||||
}
|
||||
|
||||
private function checkPhraseanetScope(OutputInterface $output)
|
||||
{
|
||||
$required = array('servername', 'maintenance', 'debug', 'display_errors', 'database');
|
||||
|
||||
$phraseanet = $this->configuration->getPhraseanet();
|
||||
|
||||
foreach ($phraseanet->all() as $conf => $value)
|
||||
{
|
||||
switch ($conf)
|
||||
{
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, $conf, $value, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
case 'servername':
|
||||
$url = $value;
|
||||
$required = array_diff($required, array($conf));
|
||||
|
||||
$parseUrl = parse_url($url);
|
||||
|
||||
if (empty($url))
|
||||
{
|
||||
$message = "<error>should not be empty</error>";
|
||||
$this->errors++;
|
||||
}
|
||||
elseif ($url == 'http://sub.domain.tld/')
|
||||
{
|
||||
$this->alerts++;
|
||||
$message = "<comment>may be wrong</comment>";
|
||||
}
|
||||
elseif (!filter_var($url, FILTER_VALIDATE_URL))
|
||||
{
|
||||
$message = "<error>not valid</error>";
|
||||
$this->errors++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = "<info>OK</info>";
|
||||
}
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'maintenance':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== false)
|
||||
{
|
||||
$message = '<error>Should be true</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'debug':
|
||||
case 'display_errors':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== true)
|
||||
{
|
||||
$message = '<error>Should be true</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'database':
|
||||
$required = array_diff($required, array($conf));
|
||||
try
|
||||
{
|
||||
$service = $this->configuration->getConnexion($value);
|
||||
if ($this->verifyDatabaseConnexion($service))
|
||||
{
|
||||
$message = '<info>OK</info>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = '<error>Connection not available</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$message = '<error>Unknown connection</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($required) > 0)
|
||||
{
|
||||
$output->writeln(sprintf('<error>Miss required keys %s</error>', implode(', ', $required)));
|
||||
$this->errors++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
private function checkDatabaseScope(OutputInterface $output)
|
||||
{
|
||||
$connexionName = $this->configuration->getPhraseanet()->get('database');
|
||||
$connexion = $this->configuration->getConnexion($connexionName);
|
||||
|
||||
try
|
||||
{
|
||||
if ($this->verifyDatabaseConnexion($connexion))
|
||||
{
|
||||
$work_message = '<info>Works !</info>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$work_message = '<error>Failed - could not connect !</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
|
||||
$work_message = '<error>Failed - could not connect !</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$output->writeln(sprintf("\t--> Verify connection <info>%s</info> : %s", $connexionName, $work_message));
|
||||
|
||||
$required = array('driver');
|
||||
|
||||
if (!$connexion->has('driver'))
|
||||
{
|
||||
$output->writeln("\n<error>Connection has no driver</error>");
|
||||
$this->errors++;
|
||||
}
|
||||
elseif ($connexion->get('driver') == 'pdo_mysql')
|
||||
{
|
||||
$required = array('driver', 'dbname', 'charset', 'password', 'user', 'port', 'host');
|
||||
}
|
||||
elseif ($connexion->get('driver') == 'pdo_sqlite')
|
||||
{
|
||||
$required = array('driver', 'path', 'charset');
|
||||
}
|
||||
else
|
||||
{
|
||||
$output->writeln("\n<error>Your driver is not managed</error>");
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
foreach ($connexion->all() as $conf => $value)
|
||||
{
|
||||
switch ($conf)
|
||||
{
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, $conf, $value, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
case 'charset':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
if ($value !== 'UTF8')
|
||||
{
|
||||
$message = '<comment>Not recognized</comment>';
|
||||
$this->alerts++;
|
||||
}
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'path':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = is_writable(dirname($value)) ? '<info>OK</info>' : '<error>Not writeable</error>';
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'dbname':
|
||||
case 'user':
|
||||
case 'host':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_scalar($value))
|
||||
{
|
||||
$message = '<error>Should be scalar</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'port':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!ctype_digit($value))
|
||||
{
|
||||
$message = '<error>Should be ctype_digit</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'password':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_scalar($value))
|
||||
{
|
||||
$message = '<error>Should be scalar</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$value = '***********';
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'driver':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== 'pdo_mysql')
|
||||
{
|
||||
$message = '<error>MySQL recommended</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($required) > 0)
|
||||
{
|
||||
$output->writeln(sprintf('<error>Miss required keys %s</error>', implode(', ', $required)));
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
protected function verifyDatabaseConnexion(\Symfony\Component\DependencyInjection\ParameterBag\ParameterBag $connexion)
|
||||
{
|
||||
try
|
||||
{
|
||||
$config = new \Doctrine\DBAL\Configuration();
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection($connexion->all(), $config);
|
||||
return true;
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function checkTeamplateEngineService(OutputInterface $output)
|
||||
{
|
||||
$templateEngineName = $this->configuration->getTemplating();
|
||||
$configuration = $this->configuration->getService($templateEngineName);
|
||||
|
||||
try
|
||||
{
|
||||
Core\Service\Builder::create(\bootstrap::getCore(), $templateEngineName, $configuration);
|
||||
$work_message = '<info>Works !</info>';
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$work_message = '<error>Failed - could not load template engine !</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$output->writeln(sprintf("\t--> Verify Template engine <info>%s</info> : %s", $templateEngineName, $work_message));
|
||||
|
||||
if (!$configuration->has('type'))
|
||||
{
|
||||
$output->writeln("\n<error>Configuration has no type</error>");
|
||||
$this->errors++;
|
||||
}
|
||||
elseif ($configuration->get('type') == 'TemplateEngine\\Twig')
|
||||
{
|
||||
$required = array('debug', 'charset', 'strict_variables', 'autoescape', 'optimizer');
|
||||
}
|
||||
else
|
||||
{
|
||||
$output->writeln("\n<error>Your type is not managed</error>");
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($configuration->all() as $conf => $value)
|
||||
{
|
||||
switch ($conf)
|
||||
{
|
||||
case 'type':
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== 'TemplateEngine\\Twig')
|
||||
{
|
||||
$message = '<error>Not recognized</error>';
|
||||
$this->alerts++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'options':
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_array($value))
|
||||
{
|
||||
$message = '<error>Should be array</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, 'array()', false, $message);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, $conf, 'unknown', false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($configuration->get('options') as $conf => $value)
|
||||
{
|
||||
switch ($conf)
|
||||
{
|
||||
case 'debug';
|
||||
case 'strict_variables';
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== true)
|
||||
{
|
||||
$message = '<error>Should be false</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, "\t" . $conf, $value, false, $message);
|
||||
break;
|
||||
case 'autoescape';
|
||||
case 'optimizer';
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== true)
|
||||
{
|
||||
$message = '<error>Should be true</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, "\t" . $conf, $value, false, $message);
|
||||
break;
|
||||
case 'charset';
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== 'utf-8')
|
||||
{
|
||||
$message = '<comment>Not recognized</comment>';
|
||||
$this->alerts++;
|
||||
}
|
||||
|
||||
$this->printConf($output, "\t" . $conf, $value, false, $message);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, "\t" . $conf, $value, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($required) > 0)
|
||||
{
|
||||
$output->writeln(sprintf('<error>Miss required keys %s</error>', implode(', ', $required)));
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private function checkOrmService(OutputInterface $output)
|
||||
{
|
||||
$ormName = $this->configuration->getOrm();
|
||||
$configuration = $this->configuration->getService($ormName);
|
||||
|
||||
try
|
||||
{
|
||||
$service = Core\Service\Builder::create(\bootstrap::getCore(), $ormName, $configuration);
|
||||
$work_message = '<info>Works !</info>';
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$work_message = '<error>Failed - could not connect !</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$output->writeln(sprintf("\t--> Verify ORM engine <info>%s</info> : %s", $ormName, $work_message));
|
||||
|
||||
|
||||
|
||||
if (!$configuration->has('type'))
|
||||
{
|
||||
$output->writeln("\n<error>Configuration has no type</error>");
|
||||
$this->errors++;
|
||||
}
|
||||
elseif ($configuration->get('type') == 'Orm\\Doctrine')
|
||||
{
|
||||
$required = array('debug', 'dbal', 'cache');
|
||||
}
|
||||
else
|
||||
{
|
||||
$output->writeln("\n<error>Your type is not managed</error>");
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($configuration->all() as $conf => $value)
|
||||
{
|
||||
switch ($conf)
|
||||
{
|
||||
case 'type':
|
||||
$message = $value == 'Orm\\Doctrine' ? '<info>OK</info>' : '<error>Not recognized</error>';
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'options':
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_array($value))
|
||||
{
|
||||
$message = '<error>Should be array</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, 'array()', false, $message);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, $conf, 'unknown', false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($configuration->get('options') as $conf => $value)
|
||||
{
|
||||
switch ($conf)
|
||||
{
|
||||
case 'log':
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'cache':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_array($value))
|
||||
{
|
||||
$message = '<error>Should be Array</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, 'array()', false, $message);
|
||||
|
||||
$required_caches = array('query', 'result', 'metadata');
|
||||
foreach ($value as $name => $cache_type)
|
||||
{
|
||||
$required_caches = array_diff($required_caches, array($name));
|
||||
|
||||
foreach ($cache_type as $key_cache => $value_cache)
|
||||
{
|
||||
switch ($key_cache)
|
||||
{
|
||||
case 'service':
|
||||
if ($this->probeCacheService($output, $value_cache))
|
||||
{
|
||||
$server = $name === 'result';
|
||||
if ($this->recommendedCacheService($output, $value_cache, $server))
|
||||
{
|
||||
$work_message = '<info>Works !</info>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errors++;
|
||||
$work_message = '<error>No cache required</error>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$work_message = '<error>Failed - could not connect !</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$verification = sprintf("\t--> Verify <info>%s</info> : %s", $name, $work_message);
|
||||
|
||||
|
||||
$this->printConf($output, "\t" . $key_cache, $value_cache, false, $verification);
|
||||
$this->verifyCacheOptions($output, $value_cache);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, "\t" . $key_cache, $value_cache, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
if (!isset($cache_type['service']))
|
||||
{
|
||||
$output->writeln('<error>Miss service for %s</error>', $cache_type);
|
||||
$this->errors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($required_caches) > 0)
|
||||
{
|
||||
$output->writeln(sprintf('<error>Miss required caches %s</error>', implode(', ', $required_caches)));
|
||||
$this->errors++;
|
||||
}
|
||||
break;
|
||||
case 'debug':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== true)
|
||||
{
|
||||
$message = '<error>Should be true</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'dbal':
|
||||
$required = array_diff($required, array($conf));
|
||||
try
|
||||
{
|
||||
$connexion = $this->configuration->getConnexion($value);
|
||||
$this->verifyDatabaseConnexion($connexion);
|
||||
$message = '<info>OK</info>';
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$message = '<error>Failed</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, $conf, $value, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($required) > 0)
|
||||
{
|
||||
$output->writeln(sprintf('<error>Miss required keys %s</error>', implode(', ', $required)));
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
protected function verifyCacheOptions(OutputInterface $output, $ServiceName)
|
||||
{
|
||||
try
|
||||
{
|
||||
$conf = $this->configuration->getService($ServiceName);
|
||||
|
||||
$Service = Core\Service\Builder::create(
|
||||
\bootstrap::getCore(), $ServiceName, $conf
|
||||
);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$required_options = array();
|
||||
|
||||
switch ($Service->getType())
|
||||
{
|
||||
default:
|
||||
break;
|
||||
case 'memcache':
|
||||
$required_options = array('host', 'port');
|
||||
break;
|
||||
}
|
||||
|
||||
if ($required_options)
|
||||
{
|
||||
foreach ($conf->get('options') as $conf => $value)
|
||||
{
|
||||
switch ($conf)
|
||||
{
|
||||
case 'host';
|
||||
$required_options = array_diff($required_options, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_scalar($value))
|
||||
{
|
||||
$message = '<error>Should be scalar</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, "\t\t" . $conf, $value, false, $message);
|
||||
break;
|
||||
case 'port';
|
||||
$required_options = array_diff($required_options, array($conf));
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!ctype_digit($value))
|
||||
{
|
||||
$message = '<comment>Not recognized</comment>';
|
||||
$this->alerts++;
|
||||
}
|
||||
|
||||
$this->printConf($output, "\t\t" . $conf, $value, false, $message);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, "\t\t" . $conf, $value, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($required_options) > 0)
|
||||
{
|
||||
$output->writeln(sprintf('<error>Miss required keys %s</error>', implode(', ', $required_options)));
|
||||
$this->errors++;
|
||||
}
|
||||
}
|
||||
|
||||
protected function probeCacheService(OutputInterface $output, $ServiceName)
|
||||
{
|
||||
try
|
||||
{
|
||||
$originalConfiguration = $this->configuration->getService($ServiceName);
|
||||
|
||||
$Service = Core\Service\Builder::create(
|
||||
\bootstrap::getCore(), $ServiceName, $originalConfiguration
|
||||
);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($Service->getDriver()->isServer())
|
||||
{
|
||||
switch ($Service->getType())
|
||||
{
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
case 'memcache':
|
||||
if (!@memcache_connect($Service->getHost(), $Service->getPort()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function recommendedCacheService(OutputInterface $output, $ServiceName, $server)
|
||||
{
|
||||
try
|
||||
{
|
||||
$originalConfiguration = $this->configuration->getService($ServiceName);
|
||||
|
||||
$Service = Core\Service\Builder::create(
|
||||
\bootstrap::getCore(), $ServiceName, $originalConfiguration
|
||||
);
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return $Service->getType() === 'array';
|
||||
}
|
||||
|
||||
private function printConf($output, $scope, $value, $scopage = false, $message = '')
|
||||
{
|
||||
if (is_array($value))
|
||||
{
|
||||
foreach ($value as $key => $val)
|
||||
{
|
||||
if ($scopage)
|
||||
$key = $scope . ":" . $key;
|
||||
$this->printConf($output, $key, $val, $scopage, '');
|
||||
}
|
||||
}
|
||||
elseif (is_bool($value))
|
||||
{
|
||||
if ($value === false)
|
||||
{
|
||||
$value = 'false';
|
||||
}
|
||||
elseif ($value === true)
|
||||
{
|
||||
$value = 'true';
|
||||
}
|
||||
$output->writeln(sprintf("\t%s: %s %s", $scope, $value, $message));
|
||||
}
|
||||
elseif (!empty($value))
|
||||
{
|
||||
$output->writeln(sprintf("\t%s: %s %s", $scope, $value, $message));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -44,6 +44,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
, 'checkOpcodeCacheService'
|
||||
);
|
||||
protected $errors = 0;
|
||||
protected $alerts = 0;
|
||||
|
||||
public function __construct($name = null)
|
||||
{
|
||||
@@ -52,6 +53,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
$this->setDescription('Ensure production settings');
|
||||
|
||||
$this->addArgument('conf', InputArgument::OPTIONAL, 'The file to check', null);
|
||||
$this->addOption('strict', 's', InputOption::VALUE_NONE, 'Wheter to fail on alerts or not');
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -74,8 +76,23 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
|
||||
$this->runTests($output);
|
||||
|
||||
$retval = $this->errors;
|
||||
if ($input->getOption('strict'))
|
||||
{
|
||||
$retval += $this->alerts;
|
||||
}
|
||||
|
||||
if ($retval > 0)
|
||||
{
|
||||
$output->writeln("\n<error>Some errors found in your conf</error>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$output->writeln("\n<info>Your production settings are setted correctly ! Enjoy</info>");
|
||||
}
|
||||
$output->writeln('End');
|
||||
return 0;
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
private function runTests(OutputInterface $output)
|
||||
@@ -112,15 +129,6 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
|
||||
call_user_func(array($this, $test), $output);
|
||||
}
|
||||
if ($this->errors)
|
||||
{
|
||||
$output->writeln("\n<error>Some errors found in your conf</error>");
|
||||
}
|
||||
else
|
||||
{
|
||||
$output->writeln("\n<info>Your production settings are setted correctly ! Enjoy</info>");
|
||||
}
|
||||
return $this->errors;
|
||||
}
|
||||
|
||||
private function checkParse(OutputInterface $output)
|
||||
@@ -156,6 +164,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
else
|
||||
{
|
||||
$work_message = '<comment>Cache server recommended</comment>';
|
||||
$this->alerts++;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -185,6 +194,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
else
|
||||
{
|
||||
$work_message = '<comment>Opcode recommended</comment>';
|
||||
$this->alerts++;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -211,6 +221,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
switch ($conf)
|
||||
{
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, $conf, $value, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
case 'servername':
|
||||
@@ -226,6 +237,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
}
|
||||
elseif ($url == 'http://sub.domain.tld/')
|
||||
{
|
||||
$this->alerts++;
|
||||
$message = "<comment>may be wrong</comment>";
|
||||
}
|
||||
elseif (!filter_var($url, FILTER_VALIDATE_URL))
|
||||
@@ -235,6 +247,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
}
|
||||
elseif ($parseUrl["scheme"] !== "https")
|
||||
{
|
||||
$this->alerts++;
|
||||
$message = "<comment>should be https</comment>";
|
||||
}
|
||||
else
|
||||
@@ -247,7 +260,14 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
case 'debug':
|
||||
case 'display_errors':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = $value ? '<error>Should be false</error>' : '<info>OK</info>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== false)
|
||||
{
|
||||
$message = '<error>Should be false</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'database':
|
||||
@@ -335,11 +355,17 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
switch ($conf)
|
||||
{
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, $conf, $value, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
case 'charset':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = $value == 'UTF8' ? '<info>OK</info>' : '<comment>Not recognized</comment>';
|
||||
$message = '<info>OK</info>';
|
||||
if ($value !== 'UTF8')
|
||||
{
|
||||
$message = '<comment>Not recognized</comment>';
|
||||
$this->alerts++;
|
||||
}
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'path':
|
||||
@@ -351,23 +377,50 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
case 'user':
|
||||
case 'host':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = is_scalar($value) ? '<info>OK</info>' : '<error>Should be scalar</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_scalar($value))
|
||||
{
|
||||
$message = '<error>Should be scalar</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'port':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = ctype_digit($value) ? '<info>OK</info>' : '<error>Should be scalar</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!ctype_digit($value))
|
||||
{
|
||||
$message = '<error>Should be ctype_digit</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'password':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = is_scalar($value) ? '<info>OK</info>' : '<error>Should be scalar</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_scalar($value))
|
||||
{
|
||||
$message = '<error>Should be scalar</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$value = '***********';
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'driver':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = $value === 'pdo_mysql' ? '<info>OK</info>' : '<error>MySQL recommended</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== 'pdo_mysql')
|
||||
{
|
||||
$message = '<error>MySQL recommended</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
}
|
||||
@@ -410,7 +463,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$work_message = '<error>Failed - could not connect !</error>';
|
||||
$work_message = '<error>Failed - could not load template engine !</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
@@ -438,14 +491,29 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
switch ($conf)
|
||||
{
|
||||
case 'type':
|
||||
$message = $value == 'TemplateEngine\\Twig' ? '<info>OK</info>' : '<error>Not recognized</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if($value !== 'TemplateEngine\\Twig')
|
||||
{
|
||||
$message = '<error>Not recognized</error>';
|
||||
$this->alerts++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'options':
|
||||
$message = is_array($value) ? '<info>OK</info>' : '<error>Should be array</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_array($value))
|
||||
{
|
||||
$message = '<error>Should be array</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, 'array()', false, $message);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, $conf, 'unknown', false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
@@ -458,21 +526,43 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
case 'debug';
|
||||
case 'strict_variables';
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = $value == false ? '<info>OK</info>' : '<error>Should be false</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== false)
|
||||
{
|
||||
$message = '<error>Should be false</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, "\t" . $conf, $value, false, $message);
|
||||
break;
|
||||
case 'autoescape';
|
||||
case 'optimizer';
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = $value == true ? '<info>OK</info>' : '<error>Should be true</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== true)
|
||||
{
|
||||
$message = '<error>Should be true</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, "\t" . $conf, $value, false, $message);
|
||||
break;
|
||||
case 'charset';
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = $value == 'utf-8' ? '<info>OK</info>' : '<comment>Not recognized</comment>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== 'utf-8')
|
||||
{
|
||||
$message = '<comment>Not recognized</comment>';
|
||||
$this->alerts++;
|
||||
}
|
||||
|
||||
$this->printConf($output, "\t" . $conf, $value, false, $message);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, "\t" . $conf, $value, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
@@ -533,10 +623,18 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'options':
|
||||
$message = is_array($value) ? '<info>OK</info>' : '<error>Should be array</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_array($value))
|
||||
{
|
||||
$message = '<error>Should be array</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, 'array()', false, $message);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, $conf, 'unknown', false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
@@ -548,12 +646,26 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
switch ($conf)
|
||||
{
|
||||
case 'log':
|
||||
$message = $value == false ? '<info>OK</info>' : '<error>Should be deactivated</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== false)
|
||||
{
|
||||
$message = '<error>Should be deactivated</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'cache':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = is_array($value) ? '<info>OK</info>' : '<error>Should be Array</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_array($value))
|
||||
{
|
||||
$message = '<error>Should be Array</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, 'array()', false, $message);
|
||||
|
||||
$required_caches = array('query', 'result', 'metadata');
|
||||
@@ -575,6 +687,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->alerts++;
|
||||
if ($server)
|
||||
{
|
||||
$work_message = '<comment>Cache server recommended</comment>';
|
||||
@@ -598,6 +711,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
$this->verifyCacheOptions($output, $value_cache);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, "\t" . $key_cache, $value_cache, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
@@ -617,7 +731,14 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
break;
|
||||
case 'debug':
|
||||
$required = array_diff($required, array($conf));
|
||||
$message = $value == false ? '<info>OK</info>' : '<error>Should be false</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if ($value !== false)
|
||||
{
|
||||
$message = '<error>Should be false</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'dbal':
|
||||
@@ -636,6 +757,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, $conf, $value, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
@@ -684,15 +806,30 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
{
|
||||
case 'host';
|
||||
$required_options = array_diff($required_options, array($conf));
|
||||
$message = is_scalar($value) ? '<info>OK</info>' : '<error>Should be scalar</error>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!is_scalar($value))
|
||||
{
|
||||
$message = '<error>Should be scalar</error>';
|
||||
$this->errors++;
|
||||
}
|
||||
|
||||
$this->printConf($output, "\t\t" . $conf, $value, false, $message);
|
||||
break;
|
||||
case 'port';
|
||||
$required_options = array_diff($required_options, array($conf));
|
||||
$message = ctype_digit($value) ? '<info>OK</info>' : '<comment>Not recognized</comment>';
|
||||
$message = '<info>OK</info>';
|
||||
|
||||
if (!ctype_digit($value))
|
||||
{
|
||||
$message = '<comment>Not recognized</comment>';
|
||||
$this->alerts++;
|
||||
}
|
||||
|
||||
$this->printConf($output, "\t\t" . $conf, $value, false, $message);
|
||||
break;
|
||||
default:
|
||||
$this->alerts++;
|
||||
$this->printConf($output, "\t\t" . $conf, $value, false, '<comment>Not recognized</comment>');
|
||||
break;
|
||||
}
|
||||
@@ -729,7 +866,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
return false;
|
||||
break;
|
||||
case 'memcache':
|
||||
if (!memcache_connect($Service->getHost(), $Service->getPort()))
|
||||
if (!@memcache_connect($Service->getHost(), $Service->getPort()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -453,7 +453,6 @@ class module_report_activity extends module_report
|
||||
$this->result[$i]['total'] += 1;
|
||||
|
||||
$total['tot_dl'] += 1;
|
||||
|
||||
}
|
||||
|
||||
$nb_row = $i + 1;
|
||||
@@ -479,7 +478,7 @@ class module_report_activity extends module_report
|
||||
* @param string $on choose the field on what you want the result
|
||||
* @return array
|
||||
*/
|
||||
public function getConnexionBase($tab = false, $on= "")
|
||||
public function getConnexionBase($tab = false, $on = "")
|
||||
{
|
||||
//default group on user column
|
||||
if (empty($on))
|
||||
@@ -577,7 +576,7 @@ class module_report_activity extends module_report
|
||||
* @param array $tab config for the html table
|
||||
* @return array
|
||||
*/
|
||||
public function getDetailDownload($tab = false, $on="")
|
||||
public function getDetailDownload($tab = false, $on = "")
|
||||
{
|
||||
empty($on) ? $on = "user" : ""; //by default always report on user
|
||||
|
||||
@@ -638,19 +637,37 @@ class module_report_activity extends module_report
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
$user = $row[$on];
|
||||
if (($save_user != $user) && !is_null($user))
|
||||
if (($save_user != $user) && !is_null($user) && !empty($user))
|
||||
{
|
||||
if ($i >= 0)
|
||||
{
|
||||
if (($this->result[$i]['nbprev'] + $this->result[$i]['nbdoc']) == 0 || ($this->result[$i]['poiddoc'] + $this->result[$i]['poidprev']) == 0)
|
||||
{
|
||||
unset($this->result[$i]);
|
||||
}
|
||||
|
||||
if (isset($this->result[$i]['poiddoc']) && isset($this->result[$i]['poidprev']))
|
||||
{
|
||||
$this->result[$i]['poiddoc'] = p4string::format_octets($this->result[$i]['poiddoc']);
|
||||
$this->result[$i]['poidprev'] = p4string::format_octets($this->result[$i]['poidprev']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$i++;
|
||||
|
||||
$this->result[$i]['nbprev'] = 0;
|
||||
$this->result[$i]['poidprev'] = 0;
|
||||
$this->result[$i]['nbdoc'] = 0;
|
||||
$this->result[$i]['poiddoc'] = 0;
|
||||
}
|
||||
|
||||
//doc info
|
||||
if ($row['final'] == 'document' &&
|
||||
!is_null($user) && !is_null($row['usrid']))
|
||||
{
|
||||
$this->result[$i]['nbdoc'] = (!is_null($row['nb']) ? $row['nb'] : 0);
|
||||
$this->result[$i]['poiddoc'] = (!is_null($row['poid']) ?
|
||||
p4string::format_octets($row['poid']) : 0);
|
||||
if (!isset($this->result[$i]['nbprev']))
|
||||
$this->result[$i]['nbprev'] = 0;
|
||||
if (!isset($this->result[$i]['poidprev']))
|
||||
$this->result[$i]['poidprev'] = 0;
|
||||
$this->result[$i]['poiddoc'] = (!is_null($row['poid']) ? $row['poid'] : 0);
|
||||
$this->result[$i]['user'] = empty($row[$on]) ?
|
||||
"<i>" . _('report:: non-renseigne') . "</i>" : $row[$on];
|
||||
$total['nbdoc'] += $this->result[$i]['nbdoc'];
|
||||
@@ -658,26 +675,25 @@ class module_report_activity extends module_report
|
||||
$this->result[$i]['usrid'] = $row['usrid'];
|
||||
}
|
||||
//preview info
|
||||
if ($row['final'] == 'preview' &&
|
||||
if (($row['final'] == 'preview' || $row['final'] == 'thumbnail') &&
|
||||
!is_null($user) &&
|
||||
!is_null($row['usrid']))
|
||||
{
|
||||
if (!isset($this->result[$i]['nbdoc']))
|
||||
$this->result[$i]['nbdoc'] = 0;
|
||||
if (!isset($this->result[$i]['poiddoc']))
|
||||
$this->result[$i]['poiddoc'] = 0;
|
||||
$this->result[$i]['nbprev'] = (!is_null($row['nb']) ? $row['nb'] : 0);
|
||||
$this->result[$i]['poidprev'] = (!is_null($row['poid']) ?
|
||||
p4string::format_octets($row['poid']) : 0);
|
||||
|
||||
$this->result[$i]['nbprev'] += (!is_null($row['nb']) ? $row['nb'] : 0);
|
||||
$this->result[$i]['poidprev'] += (!is_null($row['poid']) ? $row['poid'] : 0);
|
||||
|
||||
$this->result[$i]['user'] = empty($row[$on]) ?
|
||||
"<i>" . _('report:: non-renseigne') . "</i>" : $row[$on];
|
||||
$total['nbprev'] += $this->result[$i]['nbprev'];
|
||||
$total['nbprev'] += (!is_null($row['nb']) ? $row['nb'] : 0);
|
||||
$total['poidprev'] += (!is_null($row['poid']) ? $row['poid'] : 0);
|
||||
$this->result[$i]['usrid'] = $row['usrid'];
|
||||
}
|
||||
|
||||
$save_user = $user;
|
||||
}
|
||||
|
||||
unset($this->result[$i]);
|
||||
$nb_row = $i + 1;
|
||||
$this->total = $nb_row;
|
||||
|
||||
|
66
lib/classes/patch/320h.class.php
Normal file
66
lib/classes/patch/320h.class.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class patch_320h implements patchInterface
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.2.0.0.a8';
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
private $concern = array(base::APPLICATION_BOX);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function get_release()
|
||||
{
|
||||
return $this->release;
|
||||
}
|
||||
|
||||
public function require_all_upgrades()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Array
|
||||
*/
|
||||
function concern()
|
||||
{
|
||||
return $this->concern;
|
||||
}
|
||||
|
||||
function apply(base &$appbox)
|
||||
{
|
||||
$sql = 'DELETE FROM basusr WHERE actif = "0"';
|
||||
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@@ -59,7 +59,7 @@ class patch_360 implements patchInterface
|
||||
|
||||
foreach ($tables as $table)
|
||||
{
|
||||
$sql = 'TRUNCATE ' . $table;
|
||||
$sql = 'DELETE FROM ' . $table;
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
|
@@ -54,12 +54,18 @@ class patch_3602 implements patchInterface
|
||||
|
||||
function apply(base &$databox)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
$sql = 'ALTER TABLE `metadatas` DROP INDEX `unique`';
|
||||
|
||||
$stmt = $databox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
catch(\PDOException $e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -95,8 +95,6 @@ interface record_Interface
|
||||
|
||||
public function set_binary_status($status);
|
||||
|
||||
public function get_reg_name();
|
||||
|
||||
public function get_hd_file();
|
||||
|
||||
public function delete();
|
||||
|
@@ -140,8 +140,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
const CACHE_GROUPING = 'grouping';
|
||||
const CACHE_STATUS = 'status';
|
||||
|
||||
protected static $_regfields;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param <int> $base_id
|
||||
@@ -895,16 +893,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
*/
|
||||
public function get_title($highlight = false, searchEngine_adapter $searchEngine = null)
|
||||
{
|
||||
$sbas_id = $this->get_sbas_id();
|
||||
$record_id = $this->get_record_id();
|
||||
|
||||
if ($this->is_grouping())
|
||||
{
|
||||
$regfield = self::getRegFields($sbas_id, $this->get_caption());
|
||||
|
||||
return $regfield['regname'];
|
||||
}
|
||||
|
||||
$title = '';
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
@@ -944,98 +932,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
return $title;
|
||||
}
|
||||
|
||||
public function get_description()
|
||||
{
|
||||
|
||||
if (!$this->is_grouping())
|
||||
throw new \Exception('This record is not a story');
|
||||
|
||||
$regfield = self::getRegFields($this->get_sbas_id(), $this->get_caption());
|
||||
|
||||
return $regfield['regdesc'];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param <type> $sbas_id
|
||||
* @param caption_record $desc
|
||||
* @return <type>
|
||||
*/
|
||||
protected static function getRegFields($sbas_id, caption_record $desc)
|
||||
{
|
||||
if (!self::$_regfields)
|
||||
self::load_regfields();
|
||||
|
||||
$arrayRegFields = self::$_regfields[$sbas_id];
|
||||
|
||||
$array = array();
|
||||
|
||||
foreach ($arrayRegFields as $k => $f)
|
||||
{
|
||||
$array[$f] = $k;
|
||||
}
|
||||
|
||||
$fields = array();
|
||||
$fields["regname"] = "";
|
||||
$fields["regdesc"] = "";
|
||||
$fields["regdate"] = "";
|
||||
|
||||
foreach ($desc->get_fields() as $caption_field)
|
||||
{
|
||||
/* @var $caption_field caption_field */
|
||||
$meta_struct_id = $caption_field->get_meta_struct_id();
|
||||
if (array_key_exists($meta_struct_id, $array))
|
||||
{
|
||||
$fields[$array[$meta_struct_id]] = $caption_field->get_serialized_values();
|
||||
}
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* get databox reg fields
|
||||
*
|
||||
* @todo change this shit
|
||||
* @return array
|
||||
*/
|
||||
protected static function load_regfields()
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
self::$_regfields = array();
|
||||
foreach ($appbox->get_databoxes() as $databox)
|
||||
{
|
||||
self::$_regfields[$databox->get_sbas_id()] = self::searchRegFields($databox->get_meta_structure());
|
||||
}
|
||||
|
||||
return self::$_regfields;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param databox_descriptionStructure $meta_struct
|
||||
* @return <type>
|
||||
*/
|
||||
protected function searchRegFields(databox_descriptionStructure $meta_struct)
|
||||
{
|
||||
$fields = null;
|
||||
$fields["regname"] = "";
|
||||
$fields["regdesc"] = "";
|
||||
$fields["regdate"] = "";
|
||||
|
||||
foreach ($meta_struct as $meta)
|
||||
{
|
||||
if ($meta->is_regname())
|
||||
$fields["regname"] = $meta->get_id();
|
||||
elseif ($meta->is_regdesc())
|
||||
$fields["regdesc"] = $meta->get_id();
|
||||
elseif ($meta->is_regdate())
|
||||
$fields['regdate'] = $meta->get_id();
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return media_subdef
|
||||
@@ -1487,42 +1383,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_reg_name()
|
||||
{
|
||||
if (!$this->is_grouping())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$balisename = '';
|
||||
|
||||
$struct = $this->databox->get_structure();
|
||||
|
||||
if ($sxe = simplexml_load_string($struct))
|
||||
{
|
||||
$z = $sxe->xpath('/record/description');
|
||||
if ($z && is_array($z))
|
||||
{
|
||||
foreach ($z[0] as $ki => $vi)
|
||||
{
|
||||
if ($vi['regname'] == '1')
|
||||
{
|
||||
$balisename = $ki;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$regname = '';
|
||||
if ($sxe = simplexml_load_string($this->get_xml()))
|
||||
$regname = (string) $sxe->description->$balisename;
|
||||
|
||||
return $regname;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -631,7 +631,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
|
||||
return array();
|
||||
$rs = $res['results'];
|
||||
$res = array_shift($rs);
|
||||
if (!$res['xml'])
|
||||
if (! isset($res['xml']))
|
||||
|
||||
return array();
|
||||
$sxe = simplexml_load_string($res['xml']);
|
||||
@@ -645,7 +645,8 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
|
||||
{
|
||||
$val[] = str_replace(array('[[em]]', '[[/em]]'), array('<em>', '</em>'), (string) $value);
|
||||
}
|
||||
$val = implode(' '.$field['separator'].' ', $val);
|
||||
$separator = $field['separator'] ? $field['separator'][0] : '';
|
||||
$val = implode(' '.$separator.' ', $val);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -222,14 +222,26 @@ class set_order extends set_abstract
|
||||
$core = \bootstrap::getCore();
|
||||
|
||||
$em = $core->getEntityManager();
|
||||
|
||||
$Basket = null;
|
||||
/* @var $repository \Repositories\BasketRepository */
|
||||
if($this->ssel_id)
|
||||
{
|
||||
$repository = $em->getRepository('\Entities\Basket');
|
||||
|
||||
/* @var $repository \Repositories\BasketRepository */
|
||||
try
|
||||
{
|
||||
$Basket = $repository->findUserBasket($this->ssel_id, $core->getAuthenticatedUser(), false);
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
$Basket = null;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$Basket)
|
||||
{
|
||||
$Basket = new Basket();
|
||||
$Basket = new \Entities\Basket();
|
||||
$Basket->setName(sprintf(_('Commande du %s'), $this->created_on->format('Y-m-d')));
|
||||
$Basket->setOwner($this->user);
|
||||
$Basket->setPusher($core->getAuthenticatedUser());
|
||||
@@ -265,7 +277,7 @@ class set_order extends set_abstract
|
||||
$sbas_id = phrasea::sbasFromBas($basrec['base_id']);
|
||||
$record = new record_adapter($sbas_id, $basrec['record_id']);
|
||||
|
||||
$BasketElement = new BasketElement();
|
||||
$BasketElement = new \Entities\BasketElement();
|
||||
$BasketElement->setRecord($record);
|
||||
$BasketElement->setBasket($Basket);
|
||||
|
||||
@@ -273,7 +285,6 @@ class set_order extends set_abstract
|
||||
|
||||
$em->persist($BasketElement);
|
||||
|
||||
$em->merge($Basket);
|
||||
|
||||
$params = array(
|
||||
':usr_id' => $session->get_usr_id()
|
||||
|
@@ -608,18 +608,16 @@ class setup
|
||||
{
|
||||
$stats = $Core->getCache()->getStats();
|
||||
|
||||
foreach ($stats as $name => $stat)
|
||||
{
|
||||
echo '<li>Statistics given by `' . $name . '`</li>';
|
||||
echo '<li>' . sprintf(_('setup::Serveur actif sur %s'), $registry->get('GV_cache_server_host') . ':' . $registry->get('GV_cache_server_port')) . '</li>';
|
||||
echo "<table>";
|
||||
foreach ($stat as $key => $value)
|
||||
|
||||
foreach ($stats as $name => $stat)
|
||||
{
|
||||
echo "<tr class='even'><td>" . $key . "</td><td> " . $value . "</td></tr>";
|
||||
echo "<tr class='even'><td>" . $name . "</td><td> " . $stat . "</td></tr>";
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<li class="non-blocker">' . sprintf(_('setup::Aucun serveur memcached rattache.')) . '</li>';
|
||||
@@ -643,9 +641,9 @@ class setup
|
||||
}
|
||||
|
||||
if ($found > 1)
|
||||
$constraints[] = new Setup_Constraint('Multiple opcode caches', false, 'Many opcode cache load is forbidden', true);
|
||||
$constraints[] = new Setup_Constraint('Multiple opcode caches', false, _('Many opcode cache load is forbidden'), true);
|
||||
if ($found === 0)
|
||||
$constraints[] = new Setup_Constraint('No opcode cache', false, 'No opcode cache were detected. Phraseanet strongly recommends the use of XCache or APC.', false);
|
||||
$constraints[] = new Setup_Constraint('No opcode cache', false, _('No opcode cache were detected. Phraseanet strongly recommends the use of XCache or APC.'), false);
|
||||
|
||||
return new Setup_ConstraintsIterator($constraints);
|
||||
}
|
||||
|
@@ -76,6 +76,8 @@ class sphinx_configuration
|
||||
|
||||
$options = array_merge($defaults, $options);
|
||||
|
||||
$options['charset_tables'] = array_unique($options['charset_tables']);
|
||||
|
||||
$lb = phrasea::sbas_params();
|
||||
|
||||
$conf = '';
|
||||
@@ -439,7 +441,7 @@ class sphinx_configuration
|
||||
path = /var/sphinx/datas/docs_realtime_' . $serialized . '
|
||||
|
||||
|
||||
' . $charset_abstract . '
|
||||
' . $charset_abstract . '
|
||||
|
||||
rt_field = value
|
||||
# rt_field = meta_struct_id
|
||||
@@ -593,6 +595,9 @@ searchd
|
||||
# optional, default is 256
|
||||
#
|
||||
max_filters = 512
|
||||
|
||||
compat_sphinxql_magics = 0
|
||||
|
||||
}
|
||||
|
||||
';
|
||||
|
@@ -99,7 +99,6 @@ class sphinxrt
|
||||
$cl = new SphinxClient();
|
||||
|
||||
if ($cl->Status() === false)
|
||||
|
||||
return $this;
|
||||
|
||||
$cl->SetServer($registry->get('GV_sphinx_host'), (int) $registry->get('GV_sphinx_port'));
|
||||
@@ -122,7 +121,7 @@ class sphinxrt
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function replace_in_metas($rt_id, $meta_id, $tag_id, $record_id, $sbas_id, $coll_id, $grouping, $type, Array $content, DateTime $created)
|
||||
public function replace_in_metas($rt_id, $meta_id, $tag_id, $record_id, $sbas_id, $coll_id, $grouping, $type, $content, DateTime $created)
|
||||
{
|
||||
$crc_sbas_tag = crc32($sbas_id . '_' . $tag_id);
|
||||
$crc_sbas_coll = crc32($sbas_id . '_' . $coll_id);
|
||||
@@ -131,11 +130,9 @@ class sphinxrt
|
||||
|
||||
$this->connection->beginTransaction();
|
||||
|
||||
// foreach ($content as $value)
|
||||
// {
|
||||
$sql = "REPLACE INTO " . $rt_id . " VALUES (
|
||||
'" . (int) $meta_id . "'
|
||||
,'" . str_replace("'", "\'", implode(' ', $content)) . "'
|
||||
,'" . str_replace("'", "\'", $content) . "'
|
||||
,'" . (int) $tag_id . "'
|
||||
," . (int) $record_id . "
|
||||
," . (int) $sbas_id . "
|
||||
@@ -149,7 +146,6 @@ class sphinxrt
|
||||
," . (int) $created->format('U') . " )";
|
||||
$stmt = $this->connection->prepare($sql);
|
||||
$stmt->execute();
|
||||
// }
|
||||
|
||||
$stmt->closeCursor();
|
||||
|
||||
|
@@ -10,8 +10,10 @@ $GV_sit = md5(time() . '--' . mt_rand(1000000, 9999999));
|
||||
|
||||
include_once dirname(__FILE__) . "/../../lib/classes/User/Interface.class.php";
|
||||
include_once dirname(__FILE__) . "/../../lib/classes/User/Adapter.class.php";
|
||||
|
||||
$lngs = User_Adapter::avLanguages();
|
||||
$avLanguages = array();
|
||||
|
||||
foreach ($lngs as $lng => $locales)
|
||||
{
|
||||
foreach ($locales as $loc => $locname)
|
||||
@@ -20,7 +22,26 @@ foreach ($lngs as $lng => $locales)
|
||||
}
|
||||
}
|
||||
|
||||
$eventsmanager = eventsmanager_broker::getInstance(appbox::get_instance(\bootstrap::getCore()), bootstrap::getCore());
|
||||
$Core = \bootstrap::getCore();
|
||||
|
||||
$extractDateFields = function(\Alchemy\Phrasea\Core $Core) {
|
||||
$date_sort_fields = array(''=>'');
|
||||
if ($Core->getConfiguration()->isInstalled())
|
||||
{
|
||||
$ProdHelper = new Alchemy\Phrasea\Helper\Prod($Core, Symfony\Component\HttpFoundation\Request::createFromGlobals());
|
||||
$datas = $ProdHelper->get_search_datas();
|
||||
foreach ($datas['dates'] as $date)
|
||||
{
|
||||
$date_sort_fields[$date['fieldname']] = $date['fieldname'];
|
||||
}
|
||||
}
|
||||
return $date_sort_fields;
|
||||
};
|
||||
|
||||
$date_sort_fields = $extractDateFields($Core);
|
||||
|
||||
|
||||
$eventsmanager = eventsmanager_broker::getInstance(appbox::get_instance($Core), $Core);
|
||||
|
||||
$PHP_CONF = array(
|
||||
'output_buffering' => '4096' //INI_ALL
|
||||
@@ -246,18 +267,18 @@ $GV = array(
|
||||
array(
|
||||
'type' => 'enum_multi',
|
||||
'name' => 'GV_events',
|
||||
'default'=>null,
|
||||
'default' => null,
|
||||
'comment' => _('reglages:: Evenements'),
|
||||
'available'=> $eventsmanager->list_all('event'),
|
||||
'default'=> array_keys($eventsmanager->list_all('event'))
|
||||
'available' => $eventsmanager->list_all('event'),
|
||||
'default' => array_keys($eventsmanager->list_all('event'))
|
||||
),
|
||||
array(
|
||||
'type' => 'enum_multi',
|
||||
'name' => 'GV_notifications',
|
||||
'default'=>null,
|
||||
'default' => null,
|
||||
'comment' => _('reglages:: Notifications'),
|
||||
'available'=> $eventsmanager->list_all('notify'),
|
||||
'default'=> array_keys($eventsmanager->list_all('notify'))
|
||||
'available' => $eventsmanager->list_all('notify'),
|
||||
'default' => array_keys($eventsmanager->list_all('notify'))
|
||||
)
|
||||
)
|
||||
), array(
|
||||
@@ -275,7 +296,7 @@ $GV = array(
|
||||
'name' => 'GV_base_datapath_web',
|
||||
'end_slash' => true,
|
||||
'comment' => _('reglages:: dossier de stockage des vignettes publiees en acces direct'),
|
||||
'default'=>'',
|
||||
'default' => '',
|
||||
'required' => true
|
||||
),
|
||||
array(
|
||||
@@ -283,7 +304,7 @@ $GV = array(
|
||||
'name' => 'GV_base_datapath_noweb',
|
||||
'end_slash' => true,
|
||||
'comment' => _('reglages:: dossier de stockage des fichiers proteges de l\'acces direct'),
|
||||
'default'=>'',
|
||||
'default' => '',
|
||||
'required' => true
|
||||
),
|
||||
array(
|
||||
@@ -296,39 +317,7 @@ $GV = array(
|
||||
)
|
||||
)
|
||||
)
|
||||
// , array(
|
||||
// 'section' => _('GV::section:: Serveurs de cache'),
|
||||
// 'vars' => array(
|
||||
// array(
|
||||
// 'type' => 'boolean',
|
||||
// 'name' => 'GV_use_cache',
|
||||
// 'comment' => _('reglages:: Utiliser un serveur de cache'),
|
||||
// 'default' => false,
|
||||
// 'required' => true
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'enum',
|
||||
// 'name' => 'GV_cache_server_type',
|
||||
// 'comment' => _('reglages:: Utiliser un serveur de cache'),
|
||||
// 'default' => '',
|
||||
// 'available' => array(''=>_('Aucun'),'redis' => 'Redis', 'memcached' => 'Memcached')
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'string',
|
||||
// 'name' => 'GV_cache_server_host',
|
||||
// 'comment' => _('setup:: Hote du Serveur de cache'),
|
||||
// 'default' => '127.0.0.1',
|
||||
// 'required' => false
|
||||
// ),
|
||||
// array(
|
||||
// 'type' => 'integer',
|
||||
// 'name' => 'GV_cache_server_port',
|
||||
// 'comment' => _('reglages:: port du serveur de cache'),
|
||||
// 'default' => 11211
|
||||
// )
|
||||
// )
|
||||
// )
|
||||
,array(
|
||||
, array(
|
||||
'section' => _('GV::section:: Serveur Sphinx'),
|
||||
'vars' => array(
|
||||
array(
|
||||
@@ -362,6 +351,18 @@ $GV = array(
|
||||
'default' => 9308
|
||||
)
|
||||
)
|
||||
)
|
||||
, array(
|
||||
'section' => _('Phrasea Engine'),
|
||||
'vars' => array(
|
||||
array(
|
||||
'type' => 'enum',
|
||||
'name' => 'GV_phrasea_sort',
|
||||
'comment' => _('Default results sort'),
|
||||
'default' => '',
|
||||
'available' => $date_sort_fields
|
||||
)
|
||||
)
|
||||
), array(
|
||||
'section' => _('GV::section:: Executables externes'),
|
||||
'vars' => array(
|
||||
@@ -415,7 +416,7 @@ $GV = array(
|
||||
'type' => 'string',
|
||||
'name' => 'GV_cli',
|
||||
'comment' => _('reglages:: executable PHP CLI'),
|
||||
'default'=>'',
|
||||
'default' => '',
|
||||
'required' => true
|
||||
),
|
||||
array(
|
||||
@@ -427,21 +428,21 @@ $GV = array(
|
||||
array(
|
||||
'type' => 'string',
|
||||
'name' => 'GV_imagick',
|
||||
'default'=>'',
|
||||
'default' => '',
|
||||
'comment' => _('reglages:: chemin de l\'executable convert'),
|
||||
'required' => true
|
||||
),
|
||||
array(
|
||||
'type' => 'string',
|
||||
'name' => 'GV_pathcomposite',
|
||||
'default'=>'',
|
||||
'default' => '',
|
||||
'comment' => _('reglages:: chemin de l\'executable composite'),
|
||||
'required' => true
|
||||
),
|
||||
array(
|
||||
'type' => 'string',
|
||||
'name' => 'GV_exiftool',
|
||||
'default'=>'',
|
||||
'default' => '',
|
||||
'comment' => _('reglages:: chemin de l\'executable exiftools'),
|
||||
'required' => true
|
||||
),
|
||||
@@ -811,13 +812,12 @@ $GV = array(
|
||||
), array(
|
||||
'section' => _('GV::section:: Configuration du client'),
|
||||
'vars' => array(
|
||||
// array(
|
||||
// 'type' => 'enum',
|
||||
// 'name' => 'GV_bandeauHome',
|
||||
// 'comment' => _('reglages:: Affichage par defaut de la home du client'),
|
||||
// 'available' => array('QUERY' => _('Question'), 'PUBLI' => _('Publications'), 'HELP' => _('Aide')),
|
||||
// 'default' => 'QUERY'
|
||||
// ),
|
||||
array(
|
||||
'type' => 'integer',
|
||||
'name' => 'GV_download_max',
|
||||
'comment' => _('Maximum megabytes allowed in download (if request is bigger, then mail is still available)'),
|
||||
'default' => 120
|
||||
),
|
||||
array(
|
||||
'type' => 'integer',
|
||||
'name' => 'GV_ong_search',
|
||||
|
@@ -5160,30 +5160,6 @@
|
||||
<default></default>
|
||||
<comment></comment>
|
||||
</field>
|
||||
<field>
|
||||
<name>regdate</name>
|
||||
<type>tinyint(1) unsigned</type>
|
||||
<null>YES</null>
|
||||
<extra></extra>
|
||||
<default></default>
|
||||
<comment></comment>
|
||||
</field>
|
||||
<field>
|
||||
<name>regname</name>
|
||||
<type>tinyint(1) unsigned</type>
|
||||
<null>YES</null>
|
||||
<extra></extra>
|
||||
<default></default>
|
||||
<comment></comment>
|
||||
</field>
|
||||
<field>
|
||||
<name>regdesc</name>
|
||||
<type>tinyint(1) unsigned</type>
|
||||
<null>YES</null>
|
||||
<extra></extra>
|
||||
<default></default>
|
||||
<comment></comment>
|
||||
</field>
|
||||
<field>
|
||||
<name>report</name>
|
||||
<type>tinyint(1) unsigned</type>
|
||||
@@ -5261,27 +5237,6 @@
|
||||
<field>required</field>
|
||||
</fields>
|
||||
</index>
|
||||
<index>
|
||||
<name>regname</name>
|
||||
<type>UNIQUE</type>
|
||||
<fields>
|
||||
<field>regname</field>
|
||||
</fields>
|
||||
</index>
|
||||
<index>
|
||||
<name>regdate</name>
|
||||
<type>UNIQUE</type>
|
||||
<fields>
|
||||
<field>regdate</field>
|
||||
</fields>
|
||||
</index>
|
||||
<index>
|
||||
<name>regdesc</name>
|
||||
<type>UNIQUE</type>
|
||||
<fields>
|
||||
<field>regdesc</field>
|
||||
</fields>
|
||||
</index>
|
||||
<index>
|
||||
<name>sorter</name>
|
||||
<type>UNIQUE</type>
|
||||
@@ -5826,7 +5781,7 @@
|
||||
<field>
|
||||
<name>results</name>
|
||||
<type>int(11) unsigned</type>
|
||||
<null></null>
|
||||
<null>YES</null>
|
||||
<extra></extra>
|
||||
<default>0</default>
|
||||
<comment></comment>
|
||||
|
@@ -149,7 +149,7 @@
|
||||
<SpecialInstruct src="/rdf:RDF/rdf:Description/IPTC:SpecialInstructions"/>
|
||||
|
||||
<!-- 2:55 -->
|
||||
<Date src="/rdf:RDF/rdf:Description/IPTC:DateCreated" type="date" regdate="1" />
|
||||
<Date src="/rdf:RDF/rdf:Description/IPTC:DateCreated" type="date" />
|
||||
|
||||
<!-- 2:80 -->
|
||||
<Byline src="/rdf:RDF/rdf:Description/IPTC:By-line"/>
|
||||
@@ -170,7 +170,7 @@
|
||||
<OriginalRef src="/rdf:RDF/rdf:Description/IPTC:OriginalTransmissionReference" />
|
||||
|
||||
<!-- 2:105 -->
|
||||
<Headline src="/rdf:RDF/rdf:Description/IPTC:Headline" report="1" regname="1" />
|
||||
<Headline src="/rdf:RDF/rdf:Description/IPTC:Headline" report="1" />
|
||||
|
||||
<!-- 2:110 -->
|
||||
<Credit src="/rdf:RDF/rdf:Description/IPTC:Credit" report="1" />
|
||||
@@ -179,7 +179,7 @@
|
||||
<Source src="/rdf:RDF/rdf:Description/IPTC:Source" />
|
||||
|
||||
<!-- 2:120 -->
|
||||
<Caption src="/rdf:RDF/rdf:Description/IPTC:Caption-Abstract" regdesc="1" />
|
||||
<Caption src="/rdf:RDF/rdf:Description/IPTC:Caption-Abstract" />
|
||||
|
||||
<!-- 2:122 -->
|
||||
<CaptionWriter src="/rdf:RDF/rdf:Description/IPTC:Writer-Editor" />
|
||||
|
@@ -149,7 +149,7 @@
|
||||
<Observations src="/rdf:RDF/rdf:Description/IPTC:SpecialInstructions"/>
|
||||
|
||||
<!-- 2:55 -->
|
||||
<Date src="/rdf:RDF/rdf:Description/IPTC:DateCreated" type="date" regdate="1" />
|
||||
<Date src="/rdf:RDF/rdf:Description/IPTC:DateCreated" type="date" />
|
||||
|
||||
<!-- 2:80 -->
|
||||
<Signature src="/rdf:RDF/rdf:Description/IPTC:By-line"/>
|
||||
@@ -170,7 +170,7 @@
|
||||
<ReferencesOriginales src="/rdf:RDF/rdf:Description/IPTC:OriginalTransmissionReference" />
|
||||
|
||||
<!-- 2:105 -->
|
||||
<Titre src="/rdf:RDF/rdf:Description/IPTC:Headline" report="1" regname="1" />
|
||||
<Titre src="/rdf:RDF/rdf:Description/IPTC:Headline" report="1" />
|
||||
|
||||
<!-- 2:110 -->
|
||||
<Credit src="/rdf:RDF/rdf:Description/IPTC:Credit" report="1" />
|
||||
@@ -179,7 +179,7 @@
|
||||
<Source src="/rdf:RDF/rdf:Description/IPTC:Source" />
|
||||
|
||||
<!-- 2:120 -->
|
||||
<Legende src="/rdf:RDF/rdf:Description/IPTC:Caption-Abstract" regdesc="1" />
|
||||
<Legende src="/rdf:RDF/rdf:Description/IPTC:Caption-Abstract" />
|
||||
|
||||
<!-- 2:122 -->
|
||||
<Redacteur src="/rdf:RDF/rdf:Description/IPTC:Writer-Editor" />
|
||||
|
@@ -9,6 +9,7 @@
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="true"
|
||||
verbose="false"
|
||||
bootstrap="unitTest/bootstrap.inc"
|
||||
>
|
||||
<!--
|
||||
<logging>
|
||||
@@ -31,6 +32,13 @@
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<blacklist>
|
||||
<directory>./vendor</directory>
|
||||
<directory>./unitTest</directory>
|
||||
</blacklist>
|
||||
</filter>
|
||||
|
||||
<listeners>
|
||||
<listener class="SimpleTestListener" file="unitTest/PHPUNITListener.inc"></listener>
|
||||
</listeners>
|
||||
|
@@ -363,6 +363,39 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
}
|
||||
}
|
||||
|
||||
public function testRecordsCaptionRoute()
|
||||
{
|
||||
foreach (static::$databoxe_ids as $databox_id)
|
||||
{
|
||||
$databox = databox::get_instance($databox_id);
|
||||
|
||||
$collection = array_shift($databox->get_collections());
|
||||
$system_file = new system_file(__DIR__ . '/../../../testfiles/cestlafete.jpg');
|
||||
|
||||
$record = record_adapter::create($collection, $system_file);
|
||||
|
||||
$record_id = $record->get_record_id();
|
||||
|
||||
$route = '/records/' . $databox_id . '/' . $record_id . '/caption/?oauth_token=' . self::$token;
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
|
||||
$crawler = $this->client->request('GET', $route);
|
||||
$content = json_decode($this->client->getResponse()->getContent());
|
||||
|
||||
$this->evaluateResponse200($this->client->getResponse());
|
||||
$this->evaluateMetaJson200($content);
|
||||
|
||||
$this->evaluateRecordsCaptionResponse($content);
|
||||
$record->delete();
|
||||
}
|
||||
$route = '/records/24892534/51654651553/metadatas/?oauth_token=' . self::$token;
|
||||
$this->evaluateNotFoundRoute($route, array('GET'));
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
$route = '/records/any_bad_id/sfsd5qfsd5/metadatas/?oauth_token=' . self::$token;
|
||||
$this->evaluateBadRequestRoute($route, array('GET'));
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
}
|
||||
|
||||
public function testRecordsMetadatasRoute()
|
||||
{
|
||||
foreach (static::$databoxe_ids as $databox_id)
|
||||
@@ -654,7 +687,7 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
if (!in_array($metadata->meta_id, array_keys($toupdate)))
|
||||
continue;
|
||||
$saved_value = $toupdate[$metadata->meta_id]['value'][0];
|
||||
$saved_value = $toupdate[$metadata->meta_id]['value'];
|
||||
$this->assertEquals($saved_value, $metadata->value);
|
||||
}
|
||||
$record->delete();
|
||||
@@ -1160,6 +1193,20 @@ class ApiJsonApplication extends PhraseanetWebTestCaseAbstract
|
||||
}
|
||||
}
|
||||
|
||||
protected function evaluateRecordsCaptionResponse($content)
|
||||
{
|
||||
foreach ($content->response as $field)
|
||||
{
|
||||
$this->assertTrue(is_object($field), 'Un bloc field est un objet');
|
||||
$this->assertObjectHasAttribute('meta_structure_id', $meta);
|
||||
$this->assertTrue(is_int($field->meta_structure_id));
|
||||
$this->assertObjectHasAttribute('name', $field);
|
||||
$this->assertTrue(is_string($meta->name));
|
||||
$this->assertObjectHasAttribute('value', $field);
|
||||
$this->assertTrue(is_string($meta->value));
|
||||
}
|
||||
}
|
||||
|
||||
protected function evaluateRecordsMetadataResponse($content)
|
||||
{
|
||||
$this->assertObjectHasAttribute("metadatas", $content->response);
|
||||
|
@@ -369,6 +369,39 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
|
||||
}
|
||||
}
|
||||
|
||||
public function testRecordsCaptionRoute()
|
||||
{
|
||||
foreach (static::$databoxe_ids as $databox_id)
|
||||
{
|
||||
$databox = databox::get_instance($databox_id);
|
||||
|
||||
$collection = array_shift($databox->get_collections());
|
||||
$system_file = new system_file(__DIR__ . '/../../../testfiles/cestlafete.jpg');
|
||||
|
||||
$record = record_adapter::create($collection, $system_file);
|
||||
|
||||
$record_id = $record->get_record_id();
|
||||
|
||||
$route = '/records/' . $databox_id . '/' . $record_id . '/caption/?oauth_token=' . self::$token;
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
|
||||
$crawler = $this->client->request('GET', $route , array(), array(), array("HTTP_ACCEPT" => "application/yaml"));
|
||||
$content = self::$yaml->parse($this->client->getResponse()->getContent());
|
||||
|
||||
$this->evaluateResponse200($this->client->getResponse());
|
||||
$this->evaluateMetaYaml200($content);
|
||||
|
||||
$this->evaluateRecordsCaptionResponse($content);
|
||||
$record->delete();
|
||||
}
|
||||
$route = '/records/24892534/51654651553/metadatas/?oauth_token=' . self::$token;
|
||||
$this->evaluateNotFoundRoute($route, array('GET'));
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
$route = '/records/any_bad_id/sfsd5qfsd5/metadatas/?oauth_token=' . self::$token;
|
||||
$this->evaluateBadRequestRoute($route, array('GET'));
|
||||
$this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
|
||||
}
|
||||
|
||||
public function testRecordsMetadatasRoute()
|
||||
{
|
||||
foreach (static::$databoxe_ids as $databox_id)
|
||||
@@ -681,7 +714,7 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
|
||||
{
|
||||
if (!in_array($metadata["meta_id"], array_keys($toupdate)))
|
||||
continue;
|
||||
$saved_value = $toupdate[$metadata["meta_id"]]['value'][0];
|
||||
$saved_value = $toupdate[$metadata["meta_id"]]['value'];
|
||||
$this->assertEquals($saved_value, $metadata["value"]);
|
||||
}
|
||||
$record->delete();
|
||||
@@ -1197,6 +1230,20 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
|
||||
}
|
||||
}
|
||||
|
||||
protected function evaluateRecordsCaptionResponse($content)
|
||||
{
|
||||
foreach ($content["response"] as $field)
|
||||
{
|
||||
$this->assertTrue(is_array($field), 'Un bloc field est un objet');
|
||||
$this->assertArrayHasKey('meta_structure_id', $meta);
|
||||
$this->assertTrue(is_int($field["meta_structure_id"]));
|
||||
$this->assertArrayHasKey('name', $field);
|
||||
$this->assertTrue(is_string($meta["name"]));
|
||||
$this->assertArrayHasKey('value', $field);
|
||||
$this->assertTrue(is_string($meta["value"]));
|
||||
}
|
||||
}
|
||||
|
||||
protected function evaluateRecordsMetadataResponse($content)
|
||||
{
|
||||
$this->assertArrayHasKey("metadatas", $content["response"]);
|
||||
|
@@ -59,9 +59,6 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, 'readonly_' . $id => 0
|
||||
, 'type_' . $id => 'string'
|
||||
, 'vocabulary_' . $id => 'User'
|
||||
, 'regname' => $id
|
||||
, 'regdate' => $id
|
||||
, 'regdesc' => $id
|
||||
));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
@@ -149,9 +146,6 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, 'readonly_' . $id => 0
|
||||
, 'type_' . $id => 'string'
|
||||
, 'vocabulary_' . $id => 'Unknow_Vocabulary'
|
||||
, 'regname' => $id
|
||||
, 'regdate' => $id
|
||||
, 'regdesc' => $id
|
||||
));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
@@ -169,9 +163,6 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, 'readonly_' . $id => 0
|
||||
, 'type_' . $id => 'string'
|
||||
, 'vocabulary_' . $id => 'Unknow_Vocabulary'
|
||||
, 'regname' => $id
|
||||
, 'regdate' => $id
|
||||
, 'regdesc' => $id
|
||||
));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
@@ -194,9 +185,6 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, 'readonly_' . $id => 0
|
||||
, 'type_' . $id => 'string'
|
||||
, 'vocabulary_' . $id => 'Unknow_Vocabulary'
|
||||
, 'regname' => $id
|
||||
, 'regdate' => $id
|
||||
, 'regdesc' => $id
|
||||
));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
@@ -220,9 +208,6 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, 'readonly_' . $id => 0
|
||||
, 'type_' . $id => 'string'
|
||||
, 'vocabulary_' . $id => 'Unknow_Vocabulary'
|
||||
, 'regname' => $id
|
||||
, 'regdate' => $id
|
||||
, 'regdesc' => $id
|
||||
));
|
||||
|
||||
$this->assertTrue($this->client->getResponse()->isRedirect());
|
||||
@@ -251,9 +236,6 @@ class DescriptionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
, 'readonly_' . $id => 0
|
||||
, 'type_' . $id => 'string'
|
||||
, 'vocabulary_' . $id => 'User'
|
||||
, 'regname' => $id
|
||||
, 'regdate' => $id
|
||||
, 'regdesc' => $id
|
||||
));
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$this->assertEquals("You are not allowed to access this zone", $this->client->getResponse()->getContent());
|
||||
|
@@ -461,6 +461,74 @@ class ControllerBasketTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertEquals(2, $basket->getElements()->count());
|
||||
}
|
||||
|
||||
|
||||
public function testAddElementToValidationPost()
|
||||
{
|
||||
|
||||
$em = self::$core->getEntityManager();
|
||||
|
||||
$datas = $em->getRepository('Entities\ValidationData')->findAll();
|
||||
$countDatas = count($datas);
|
||||
|
||||
$validationSession = new \Entities\ValidationSession();
|
||||
|
||||
$validationSession->setDescription('Une description au hasard');
|
||||
$validationSession->setName('Un nom de validation');
|
||||
$expires = new \DateTime();
|
||||
$expires->modify('+1 week');
|
||||
$validationSession->setExpires($expires);
|
||||
$validationSession->setInitiator(self::$user);
|
||||
|
||||
$basket = new \Entities\Basket();
|
||||
$basket->setName('test');
|
||||
$basket->setDescription('description');
|
||||
$basket->setOwner(self::$user);
|
||||
$basket->setValidation($validationSession);
|
||||
$validationSession->setBasket($basket);
|
||||
|
||||
|
||||
$validationParticipant = new \Entities\ValidationParticipant();
|
||||
$validationParticipant->setSession($validationSession);
|
||||
$validationParticipant->setUser(self::$user_alt1);
|
||||
$validationSession->addValidationParticipant($validationParticipant);
|
||||
|
||||
$em->persist($validationParticipant);
|
||||
$em->persist($basket);
|
||||
$em->persist($validationSession);
|
||||
|
||||
$em->flush();
|
||||
|
||||
$route = sprintf('/baskets/%s/addElements/', $basket->getId());
|
||||
|
||||
$records = array(
|
||||
self::$record_1->get_serialize_key(),
|
||||
self::$record_2->get_serialize_key(),
|
||||
' ',
|
||||
'42',
|
||||
'abhak',
|
||||
self::$record_no_access->get_serialize_key(),
|
||||
);
|
||||
|
||||
$lst = implode(';', $records);
|
||||
|
||||
$this->client->request('POST', $route, array('lst' => $lst));
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
|
||||
$this->assertEquals(302, $response->getStatusCode());
|
||||
|
||||
$em = self::$core->getEntityManager();
|
||||
/* @var $em \Doctrine\ORM\EntityManager */
|
||||
$basket = $em->getRepository('Entities\Basket')->find($basket->getId());
|
||||
|
||||
$this->assertEquals(2, $basket->getElements()->count());
|
||||
|
||||
$datas = $em->getRepository('Entities\ValidationData')->findAll();
|
||||
|
||||
$this->assertTrue($countDatas < count($datas), 'assert that '.count($datas).' > '.$countDatas );
|
||||
}
|
||||
|
||||
|
||||
public function testAddElementPostJSON()
|
||||
{
|
||||
$basket = $this->insertOneBasket();
|
||||
|
@@ -50,7 +50,7 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
public function tearDown()
|
||||
{
|
||||
parent::tearDown();
|
||||
if(self::$api instanceof Bridge_Api)
|
||||
if (self::$api instanceof Bridge_Api)
|
||||
self::$api->delete();
|
||||
if (self::$account instanceof Bridge_Account)
|
||||
self::$account->delete();
|
||||
@@ -163,15 +163,6 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
self::$account = Bridge_Account::create(appbox::get_instance(\bootstrap::getCore()), self::$api, self::$user, 'kirikoo', 'coucou');
|
||||
}
|
||||
|
||||
public function testLogoutDeconnected()
|
||||
{
|
||||
$url = sprintf('/bridge/adapter/%d/logout/', self::$account->get_id());
|
||||
$crawler = $this->client->request('GET', $url);
|
||||
$pageContent = $this->client->getResponse()->getContent();
|
||||
$this->assertContains("/adapter/" . self::$account->get_id() . "/logout/", $pageContent);
|
||||
$this->deconnected($crawler, $pageContent);
|
||||
}
|
||||
|
||||
public function testLogout()
|
||||
{
|
||||
self::$account->get_settings()->set("auth_token", "somethingNotNull"); //connected
|
||||
@@ -192,16 +183,6 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertNotContains(self::$account->get_api()->generate_login_url(registry::get_instance(), self::$account->get_api()->get_connector()->get_name()), $this->client->getResponse()->getContent());
|
||||
}
|
||||
|
||||
public function testLoadElementsDisconnected()
|
||||
{
|
||||
$url = sprintf("/bridge/adapter/%s/load-elements/%s/", self::$account->get_id(), self::$account->get_api()->get_connector()->get_default_element_type());
|
||||
$crawler = $this->client->request('GET', $url, array("page" => 1));
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$pageContent = $this->client->getResponse()->getContent();
|
||||
$this->assertContains($url, $pageContent);
|
||||
$this->deconnected($crawler, $pageContent);
|
||||
}
|
||||
|
||||
public function testLoadRecords()
|
||||
{
|
||||
self::$account->get_settings()->set("auth_token", "somethingNotNull"); //connected
|
||||
@@ -215,7 +196,8 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testLoadRecordsDisconnected()
|
||||
{
|
||||
self::$account->get_settings()->set("auth_token", null);//deconnected
|
||||
$this->client->followRedirects();
|
||||
self::$account->get_settings()->set("auth_token", null); //deconnected
|
||||
$url = sprintf("/bridge/adapter/%s/load-records/", self::$account->get_id());
|
||||
$crawler = $this->client->request('GET', $url, array("page" => 1));
|
||||
$pageContent = $this->client->getResponse()->getContent();
|
||||
@@ -235,7 +217,8 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
|
||||
public function testLoadContainersDisconnected()
|
||||
{
|
||||
self::$account->get_settings()->set("auth_token", null);//deconnected
|
||||
$this->client->followRedirects();
|
||||
self::$account->get_settings()->set("auth_token", null); //deconnected
|
||||
$url = sprintf("/bridge/adapter/%s/load-containers/%s/", self::$account->get_id(), self::$account->get_api()->get_connector()->get_default_container_type());
|
||||
$crawler = $this->client->request('GET', $url, array("page" => 1));
|
||||
$pageContent = $this->client->getResponse()->getContent();
|
||||
@@ -243,9 +226,33 @@ class BridgeApplication extends PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->deconnected($crawler, $pageContent);
|
||||
}
|
||||
|
||||
public function testLoadElementsDisconnected()
|
||||
{
|
||||
$this->client->followRedirects();
|
||||
self::$account->get_settings()->set("auth_token", null); //deconnected
|
||||
$url = sprintf("/bridge/adapter/%s/load-elements/%s/", self::$account->get_id(), self::$account->get_api()->get_connector()->get_default_element_type());
|
||||
$crawler = $this->client->request('GET', $url, array("page" => 1));
|
||||
$this->assertTrue($this->client->getResponse()->isOk());
|
||||
$pageContent = $this->client->getResponse()->getContent();
|
||||
$this->assertContains($url, $pageContent);
|
||||
$this->deconnected($crawler, $pageContent);
|
||||
}
|
||||
|
||||
public function testLogoutDeconnected()
|
||||
{
|
||||
$this->client->followRedirects();
|
||||
self::$account->get_settings()->set("auth_token", null); //deconnected
|
||||
$url = sprintf('/bridge/adapter/%d/logout/', self::$account->get_id());
|
||||
$crawler = $this->client->request('GET', $url);
|
||||
$pageContent = $this->client->getResponse()->getContent();
|
||||
$this->assertContains("/adapter/" . self::$account->get_id() . "/logout/", $pageContent);
|
||||
$this->deconnected($crawler, $pageContent);
|
||||
}
|
||||
|
||||
public function testActionDeconnected()
|
||||
{
|
||||
self::$account->get_settings()->set("auth_token", null);//deconnected
|
||||
$this->client->followRedirects();
|
||||
self::$account->get_settings()->set("auth_token", null); //deconnected
|
||||
$url = sprintf("/bridge/action/%s/une action/%s/", self::$account->get_id(), self::$account->get_api()->get_connector()->get_default_element_type());
|
||||
$crawler = $this->client->request('GET', $url);
|
||||
$pageContent = $this->client->getResponse()->getContent();
|
||||
|
@@ -61,8 +61,8 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$crawler = $this->client->request(
|
||||
'POST', $route, array(
|
||||
'base_id' => $collection->get_base_id(),
|
||||
'name' => 'test story',
|
||||
'description' => 'test_description')
|
||||
'name' => 'test story'
|
||||
)
|
||||
);
|
||||
|
||||
$response = $this->client->getResponse();
|
||||
@@ -91,8 +91,7 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$crawler = $this->client->request(
|
||||
'POST', $route, array(
|
||||
'base_id' => $collection->get_base_id(),
|
||||
'name' => 'test story',
|
||||
'description' => 'test_description'), array(), array(
|
||||
'name' => 'test story'), array(), array(
|
||||
"HTTP_ACCEPT" => "application/json")
|
||||
);
|
||||
|
||||
@@ -117,9 +116,6 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$filter = "form[action='/prod/story/'] input[name='name']";
|
||||
$this->assertEquals(1, $crawler->filter($filter)->count());
|
||||
|
||||
$filter = "form[action='/prod/story/'] textarea[name='description']";
|
||||
$this->assertEquals(1, $crawler->filter($filter)->count());
|
||||
|
||||
$filter = "form[action='/prod/story/'] select[name='base_id']";
|
||||
$this->assertEquals(1, $crawler->filter($filter)->count());
|
||||
}
|
||||
@@ -229,7 +225,4 @@ class ControllerStoryTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@@ -7,7 +7,6 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Alchemy\Phrasea\Controller\Setup as Controller;
|
||||
use Alchemy\Phrasea\Controller\Utils as ControllerUtils;
|
||||
|
||||
require_once __DIR__ . '/../../../../../bootstrap.php';
|
||||
|
||||
return call_user_func(function()
|
||||
{
|
||||
|
@@ -7,7 +7,6 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Alchemy\Phrasea\Controller\Setup as Controller;
|
||||
use Alchemy\Phrasea\Controller\Utils as ControllerUtils;
|
||||
|
||||
require_once __DIR__ . '/../../../../../bootstrap.php';
|
||||
|
||||
return call_user_func(function()
|
||||
{
|
||||
|
@@ -27,14 +27,12 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
|
||||
parent::setUp();
|
||||
$this->options = array(
|
||||
"debug" => false
|
||||
, "log" => array('service'=>"Log\\sql_logger")
|
||||
, "log" => array('service' => "Log\\sql_logger")
|
||||
, "dbal" => "main_connexion"
|
||||
, "orm" => array(
|
||||
"cache" => array(
|
||||
"metadata" => array('service'=>"Cache\\array_cache")
|
||||
, "query" => array('service'=>"Cache\\array_cache")
|
||||
, "result" => array('service'=>"Cache\\array_cache")
|
||||
)
|
||||
, "cache" => array(
|
||||
"metadata" => array('service' => "Cache\\array_cache")
|
||||
, "query" => array('service' => "Cache\\array_cache")
|
||||
, "result" => array('service' => "Cache\\array_cache")
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -83,7 +81,7 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
public function testNoCacheInOptions()
|
||||
{
|
||||
unset($this->options["orm"]["cache"]);
|
||||
unset($this->options["cache"]);
|
||||
$doctrine = new \Alchemy\Phrasea\Core\Service\Orm\Doctrine(
|
||||
self::$core, 'hello', $this->options
|
||||
);
|
||||
@@ -96,7 +94,7 @@ class DoctrineTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
public function testUnknowCache()
|
||||
{
|
||||
$this->options["orm"]["cache"]["result"] = "unknowCache";
|
||||
$this->options["cache"]["result"] = "unknowCache";
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../../bootstrap.php';
|
||||
|
||||
$include_path = realpath(__DIR__ . '/../../vendor/');
|
||||
if(strpos(get_include_path(), $include_path) === false)
|
||||
|
@@ -23,7 +23,7 @@ use Doctrine\Common\DataFixtures\Loader;
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
|
||||
bootstrap::execute('test');
|
||||
\bootstrap::register_autoloads();
|
||||
|
||||
|
||||
abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
@@ -483,7 +483,8 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
//create a new core instance loaded with the test environment for each test
|
||||
self::$core = new \Alchemy\Phrasea\Core('test');
|
||||
self::$core = \bootstrap::execute('test');
|
||||
//$this->app['EM'] = self::$core->getEntityManager();
|
||||
//set Mozilla user agent as default
|
||||
$browser = Browser::getInstance();
|
||||
$browser->setUserAgent(self::USER_AGENT_FIREFOX8MAC);
|
||||
|
@@ -8,14 +8,13 @@
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace Events\Processor\Factory;
|
||||
|
||||
/**
|
||||
*
|
||||
* @package
|
||||
* @return \Alchemy\Phrasea\Core
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class Exception extends \Exception
|
||||
{
|
||||
require_once dirname(__FILE__) . '/../classes/bootstrap.class.php';
|
||||
|
||||
}
|
||||
return bootstrap::execute('test');
|
@@ -300,72 +300,6 @@ class databox_fieldTest extends PhraseanetPHPUnitAbstract
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testSet_regdate().
|
||||
*/
|
||||
public function testSet_regdate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testSet_regdesc().
|
||||
*/
|
||||
public function testSet_regdesc()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testSet_regname().
|
||||
*/
|
||||
public function testSet_regname()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testIs_regname().
|
||||
*/
|
||||
public function testIs_regname()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testIs_regdesc().
|
||||
*/
|
||||
public function testIs_regdesc()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testIs_regdate().
|
||||
*/
|
||||
public function testIs_regdate()
|
||||
{
|
||||
// Remove the following lines when you implement this test.
|
||||
$this->markTestIncomplete(
|
||||
'This test has not been implemented yet.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testGet_thumbtitle().
|
||||
*/
|
||||
|
@@ -468,11 +468,6 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
|
||||
);
|
||||
}
|
||||
|
||||
public function testGet_reg_name()
|
||||
{
|
||||
$this->assertTrue(is_string(self::$story_1->get_reg_name()));
|
||||
}
|
||||
|
||||
public function testGet_record_by_sha()
|
||||
{
|
||||
$tmp_records = record_adapter::get_record_by_sha(self::$record_1->get_sbas_id(), self::$record_1->get_sha256());
|
||||
|
2
lib/vendor/doctrine2-orm
vendored
2
lib/vendor/doctrine2-orm
vendored
Submodule lib/vendor/doctrine2-orm updated: 0e107880cf...3e7c9a1ff4
2
lib/vendor/sphinx
vendored
2
lib/vendor/sphinx
vendored
Submodule lib/vendor/sphinx updated: 3435431efe...4e878fa9c7
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user