mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 05:53:13 +00:00
Fix build
This commit is contained in:
@@ -29,7 +29,9 @@ return call_user_func(function()
|
|||||||
|
|
||||||
if (!\setup::is_installed())
|
if (!\setup::is_installed())
|
||||||
{
|
{
|
||||||
return $app->redirect("/setup/")->send();
|
$response = new \Symfony\Component\HttpFoundation\RedirectResponse('/setup/');
|
||||||
|
|
||||||
|
return $response->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
$app->get('/', function() use ($app)
|
$app->get('/', function() use ($app)
|
||||||
@@ -46,9 +48,8 @@ return call_user_func(function()
|
|||||||
return $app->redirect("/login/?redirect=/client");
|
return $app->redirect("/login/?redirect=/client");
|
||||||
});
|
});
|
||||||
|
|
||||||
$app->get('robots.txt', function() use ($app)
|
$app->get('/robots.txt', function() use ($app)
|
||||||
{
|
{
|
||||||
require __DIR__ . "/../lib/bootstrap.php";
|
|
||||||
$appbox = \appbox::get_instance();
|
$appbox = \appbox::get_instance();
|
||||||
|
|
||||||
$registry = $appbox->get_registry();
|
$registry = $appbox->get_registry();
|
||||||
@@ -64,7 +65,7 @@ return call_user_func(function()
|
|||||||
. "Disallow: /\n";
|
. "Disallow: /\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response($buffer, 200, array('Content-Type: text/plain'));
|
$response = new Response($buffer, 200, array('Content-Type' => 'text/plain'));
|
||||||
$response->setCharset('UTF-8');
|
$response->setCharset('UTF-8');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
@@ -198,19 +198,12 @@ return call_user_func(function()
|
|||||||
|
|
||||||
$app->error(function($e) use ($app)
|
$app->error(function($e) use ($app)
|
||||||
{
|
{
|
||||||
if ($e instanceof Exception_Setup_PhraseaAlreadyInstalled)
|
if ($e instanceof \Exception_Setup_PhraseaAlreadyInstalled)
|
||||||
|
{
|
||||||
|
return $app->redirect('/login/');
|
||||||
|
}
|
||||||
|
|
||||||
return $app->redirect('/login');
|
return new Response('Internal Server Error', 500);
|
||||||
|
|
||||||
return new Response(
|
|
||||||
sprintf(
|
|
||||||
'Error %s @%s:%s'
|
|
||||||
, $e->getFile()
|
|
||||||
, $e->getLine()
|
|
||||||
, $e->getMessage()
|
|
||||||
)
|
|
||||||
, 500
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $app;
|
return $app;
|
||||||
|
@@ -136,7 +136,7 @@ class Installer implements ControllerProviderInterface
|
|||||||
$servername = $request->getScheme() . '://' . $request->getHttpHost() . '/';
|
$servername = $request->getScheme() . '://' . $request->getHttpHost() . '/';
|
||||||
|
|
||||||
$setupRegistry = new \Setup_Registry();
|
$setupRegistry = new \Setup_Registry();
|
||||||
$setupRegistry->set('GV_ServerName', $servername);
|
$setupRegistry->set('GV_ServerName', $servername, \registry::TYPE_STRING);
|
||||||
|
|
||||||
$conn = $connbas = null;
|
$conn = $connbas = null;
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ class Installer implements ControllerProviderInterface
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$setupRegistry = new \Setup_Registry();
|
$setupRegistry = new \Setup_Registry();
|
||||||
$setupRegistry->set('GV_ServerName', $servername);
|
$setupRegistry->set('GV_ServerName', $servername, \registry::TYPE_STRING);
|
||||||
|
|
||||||
$appbox = \appbox::create($setupRegistry, $conn, $appbox_name, true);
|
$appbox = \appbox::create($setupRegistry, $conn, $appbox_name, true);
|
||||||
|
|
||||||
@@ -221,22 +221,22 @@ class Installer implements ControllerProviderInterface
|
|||||||
|
|
||||||
$appbox->set_registry($registry);
|
$appbox->set_registry($registry);
|
||||||
|
|
||||||
$registry->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->get('datapath_noweb')));
|
$registry->set('GV_base_datapath_noweb', \p4string::addEndSlash($request->get('datapath_noweb')), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_base_datapath_web', \p4string::addEndSlash($request->get('datapath_web')));
|
$registry->set('GV_base_datapath_web', \p4string::addEndSlash($request->get('datapath_web')), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_base_dataurl', \p4string::addEndSlash($request->get('mount_point_web')));
|
$registry->set('GV_base_dataurl', \p4string::addEndSlash($request->get('mount_point_web')), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_ServerName', $servername);
|
$registry->set('GV_ServerName', $servername, \registry::TYPE_STRING);
|
||||||
$registry->set('GV_cli', $request->get('binary_php'));
|
$registry->set('GV_cli', $request->get('binary_php'), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_imagick', $request->get('binary_convert'));
|
$registry->set('GV_imagick', $request->get('binary_convert'), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_pathcomposite', $request->get('binary_composite'));
|
$registry->set('GV_pathcomposite', $request->get('binary_composite'), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_exiftool', $request->get('binary_exiftool'));
|
$registry->set('GV_exiftool', $request->get('binary_exiftool'), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_swf_extract', $request->get('binary_swfextract'));
|
$registry->set('GV_swf_extract', $request->get('binary_swfextract'), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_pdf2swf', $request->get('binary_pdf2swf'));
|
$registry->set('GV_pdf2swf', $request->get('binary_pdf2swf'), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_swf_render', $request->get('binary_swfrender'));
|
$registry->set('GV_swf_render', $request->get('binary_swfrender'), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_unoconv', $request->get('binary_unoconv'));
|
$registry->set('GV_unoconv', $request->get('binary_unoconv'), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_ffmpeg', $request->get('binary_ffmpeg'));
|
$registry->set('GV_ffmpeg', $request->get('binary_ffmpeg'), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_mp4box', $request->get('binary_MP4Box'));
|
$registry->set('GV_mp4box', $request->get('binary_MP4Box'), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_mplayer', $request->get('binary_mplayer'));
|
$registry->set('GV_mplayer', $request->get('binary_mplayer'), \registry::TYPE_STRING);
|
||||||
$registry->set('GV_pdftotext', $request->get('binary_xpdf'));
|
$registry->set('GV_pdftotext', $request->get('binary_xpdf'), \registry::TYPE_STRING);
|
||||||
|
|
||||||
$user = \User_Adapter::create($appbox, $request->get('email'), $request->get('password'), $request->get('email'), true);
|
$user = \User_Adapter::create($appbox, $request->get('email'), $request->get('password'), $request->get('email'), true);
|
||||||
|
|
||||||
|
@@ -106,10 +106,10 @@ class PDF
|
|||||||
switch ($layout)
|
switch ($layout)
|
||||||
{
|
{
|
||||||
case "preview":
|
case "preview":
|
||||||
$this->print_preview();
|
$this->print_preview(false);
|
||||||
break;
|
break;
|
||||||
case "previewCaption":
|
case "previewCaption":
|
||||||
$this->print_preview();
|
$this->print_preview(false);
|
||||||
break;
|
break;
|
||||||
case "previewCaptionTdm":
|
case "previewCaptionTdm":
|
||||||
$this->print_preview(true);
|
$this->print_preview(true);
|
||||||
@@ -329,7 +329,7 @@ class PDF
|
|||||||
$this->pdf->SetLeftMargin($lmargin);
|
$this->pdf->SetLeftMargin($lmargin);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function print_preview($withtdm=false)
|
protected function print_preview($withtdm)
|
||||||
{
|
{
|
||||||
$appbox = \appbox::get_instance();
|
$appbox = \appbox::get_instance();
|
||||||
$registry = \registry::get_instance();
|
$registry = \registry::get_instance();
|
||||||
|
@@ -26,7 +26,7 @@ class Setup_Registry implements registryInterface
|
|||||||
return isset($this->datas[$key]) ? $this->datas[$key] : $defaultvalue;
|
return isset($this->datas[$key]) ? $this->datas[$key] : $defaultvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set($key, $value)
|
public function set($key, $value, $type)
|
||||||
{
|
{
|
||||||
$this->datas[$key] = $value;
|
$this->datas[$key] = $value;
|
||||||
}
|
}
|
||||||
|
@@ -153,7 +153,7 @@ class registry implements registryInterface
|
|||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return registry
|
* @return registry
|
||||||
*/
|
*/
|
||||||
public function set($key, $value, $type = 'string')
|
public function set($key, $value, $type)
|
||||||
{
|
{
|
||||||
$this->load();
|
$this->load();
|
||||||
$delete_cache = false;
|
$delete_cache = false;
|
||||||
|
@@ -19,7 +19,7 @@ interface registryInterface
|
|||||||
{
|
{
|
||||||
public function get($key, $defaultvalue = null);
|
public function get($key, $defaultvalue = null);
|
||||||
|
|
||||||
public function set($key, $value);
|
public function set($key, $value, $type);
|
||||||
|
|
||||||
public function is_set($key);
|
public function is_set($key);
|
||||||
|
|
||||||
|
@@ -61,8 +61,8 @@ class task_period_upgradetov32 extends task_abstract
|
|||||||
printf("taskid %s starting." . PHP_EOL, $this->get_task_id());
|
printf("taskid %s starting." . PHP_EOL, $this->get_task_id());
|
||||||
|
|
||||||
$registry = registry::get_instance();
|
$registry = registry::get_instance();
|
||||||
$registry->set('GV_cache_server_type', 'nocache');
|
$registry->set('GV_cache_server_type', 'nocache', \registry::TYPE_STRING);
|
||||||
$registry->set('GV_sphinx', false);
|
$registry->set('GV_sphinx', false, \registry::TYPE_BOOLEAN);
|
||||||
|
|
||||||
if (!$this->sbas_id)
|
if (!$this->sbas_id)
|
||||||
{
|
{
|
||||||
|
@@ -50,13 +50,8 @@ class ApplicationOverviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
return require __DIR__ . '/../../../../Alchemy/Phrasea/Application/Overview.php';
|
return require __DIR__ . '/../../../../Alchemy/Phrasea/Application/Overview.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
//$deliver_content = function(session $session, record_adapter $record, $subdef, $watermark, $stamp, $app)
|
|
||||||
//
|
|
||||||
//$app->get('/datafiles/{sbas_id}/{record_id}/{subdef}/'
|
|
||||||
|
|
||||||
function testDatafilesRouteAuthenticated()
|
function testDatafilesRouteAuthenticated()
|
||||||
{
|
{
|
||||||
// $this->client->followRedirects();
|
|
||||||
$registry = registry::get_instance();
|
$registry = registry::get_instance();
|
||||||
$crawler = $this->client->request('GET', '/datafiles/' . self::$record_1->get_sbas_id() . '/' . self::$record_1->get_record_id() . '/preview/');
|
$crawler = $this->client->request('GET', '/datafiles/' . self::$record_1->get_sbas_id() . '/' . self::$record_1->get_record_id() . '/preview/');
|
||||||
$response = $this->client->getResponse();
|
$response = $this->client->getResponse();
|
||||||
|
@@ -26,9 +26,40 @@ class ApplicationRootTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
|
|
||||||
public function testRouteSlash()
|
public function testRouteSlash()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete(
|
$crawler = $this->client->request('GET', '/');
|
||||||
'This test has not been implemented yet.'
|
$response = $this->client->getResponse();
|
||||||
);
|
$this->assertEquals(302, $response->getStatusCode());
|
||||||
|
$this->assertRegExp('/^\/login\/\?redirect=[\/a-zA-Z]+/', $response->headers->get('location'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testRouteRobots()
|
||||||
|
{
|
||||||
|
$registry = \registry::get_instance();
|
||||||
|
|
||||||
|
$original_value = $registry->get('GV_allow_search_engine');
|
||||||
|
|
||||||
|
$registry->set('GV_allow_search_engine', false, \registry::TYPE_BOOLEAN);
|
||||||
|
|
||||||
|
$crawler = $this->client->request('GET', '/robots.txt');
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('text/plain; charset=UTF-8', $response->headers->get('Content-Type'));
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$this->assertRegExp('/^Disallow: \/$/m', $response->getContent());
|
||||||
|
|
||||||
|
$registry = \registry::get_instance();
|
||||||
|
$registry->set('GV_allow_search_engine', true, \registry::TYPE_BOOLEAN);
|
||||||
|
|
||||||
|
$crawler = $this->client->request('GET', '/robots.txt');
|
||||||
|
$response = $this->client->getResponse();
|
||||||
|
$this->assertEquals(200, $response->getStatusCode());
|
||||||
|
$this->assertEquals('text/plain; charset=UTF-8', $response->headers->get('Content-Type'));
|
||||||
|
$this->assertEquals('UTF-8', $response->getCharset());
|
||||||
|
|
||||||
|
$this->assertRegExp('/^Allow: \/$/m', $response->getContent());
|
||||||
|
|
||||||
|
$registry->set('GV_allow_search_engine', $original_value, \registry::TYPE_BOOLEAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -26,9 +26,10 @@ class ApplicationSetupTest extends PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
|
|
||||||
public function testRouteSlash()
|
public function testRouteSlash()
|
||||||
{
|
{
|
||||||
$this->markTestIncomplete(
|
$crawler = $this->client->request('GET', '/');
|
||||||
'This test has not been implemented yet.'
|
$response = $this->client->getResponse();
|
||||||
);
|
$this->assertEquals(302, $response->getStatusCode());
|
||||||
|
$this->assertEquals('/login/', $response->headers->get('location'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -207,7 +207,7 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
$this->client->request('POST', '/users/search/export/');
|
$this->client->request('POST', '/users/search/export/');
|
||||||
$response = $this->client->getResponse();
|
$response = $this->client->getResponse();
|
||||||
$this->assertTrue($response->isOK());
|
$this->assertTrue($response->isOK());
|
||||||
$this->assertRegexp("#text/plain#", $response->headers->get("content-type"));
|
$this->assertEquals("text/plain; charset=UTF-8", $response->headers->get("Content-type"));
|
||||||
$this->assertEquals("attachment; filename=export.txt", $response->headers->get("content-disposition"));
|
$this->assertEquals("attachment; filename=export.txt", $response->headers->get("content-disposition"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
* $need_records = 2;
|
* $need_records = 2;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected static $need_records = 2;
|
protected static $need_records = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The application loader
|
* The application loader
|
||||||
@@ -62,7 +62,9 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
{
|
{
|
||||||
$records = array(
|
$records = array(
|
||||||
self::$record_1->get_serialize_key(),
|
self::$record_1->get_serialize_key(),
|
||||||
self::$record_2->get_serialize_key()
|
self::$record_2->get_serialize_key(),
|
||||||
|
self::$record_3->get_serialize_key(),
|
||||||
|
self::$record_4->get_serialize_key(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$lst = implode(';', $records);
|
$lst = implode(';', $records);
|
||||||
|
Reference in New Issue
Block a user