Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 298562f

Browse files
author
Charles Marion
committed
ENH: Added install
1 parent 7c6ba24 commit 298562f

26 files changed

+1165
-140
lines changed

application/AppController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected function t($text)
118118
* Assetstrore Model
119119
* @var AssetstoreModel
120120
*/
121-
var $Assetstrore;
121+
var $Assetstore;
122122
/**
123123
* Bitstream Model
124124
* @var BitstreamModel

application/Bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ protected function _initDoctype()
2323
*/
2424
protected function _initConfig()
2525
{
26+
date_default_timezone_set('Europe/Paris');
2627
Zend_Loader::loadClass( "UserDao", BASE_PATH . '/application/models/dao');
2728
Zend_Loader::loadClass( "ItemDao", BASE_PATH . '/application/models/dao');
2829
if (isset($_POST['sid']))

application/configs/application.ini

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
;development or production
33
environment=development
44
;name of the application
5-
application.name=Midas3
5+
application.name=Midas
66
;language of the application (en or fr)
7-
application.lang=fr
7+
application.lang=en
88
;Optimize JS and CSS
9-
smartoptimizer=0
9+
smartoptimizer=1
1010
;Session lifetime (minute)
1111
session.lifetime=20
1212
;alert e-mail
@@ -17,6 +17,12 @@ alert.enable=1
1717
webdav.path=midaswebdav
1818
;Path to md5sum
1919
md5sum.path=
20+
;Password prefix
21+
password.prefix=b#ube8#y
22+
;Default Assetstore
23+
defaultassetstore.id=
24+
;DefaultTimezone
25+
default.timezone=America/New_York
2026

2127
[production]
2228
;Activate error reporting using Zend

application/configs/database.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ database.profiler=0
44
database.adapter = PDO_MYSQL
55
database.params.host = localhost
66
database.params.username = root
7-
database.params.password =
7+
database.params.password = 123
88
database.params.dbname = midas3
99

1010

@@ -14,7 +14,7 @@ database.profiler=1
1414
database.adapter = PDO_MYSQL
1515
database.params.host = localhost
1616
database.params.username = root
17-
database.params.password =
17+
database.params.password = 123
1818
database.params.dbname = midas3
1919

2020
[testing]

application/controllers/ErrorController.php

Lines changed: 74 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -9,56 +9,62 @@ class ErrorController extends AppController
99
private $_environment;
1010

1111
public function init()
12-
{
12+
{
13+
parent::init();
14+
$error = $this->_getParam('error_handler');
15+
if(!isset($error)||empty($error))
16+
{
17+
return;
18+
}
19+
$mailer = new Zend_Mail();
20+
$session = new Zend_Session_Namespace('Auth_User');
21+
$db = Zend_Registry::get('dbAdapter');
22+
$profiler = $db->getProfiler();
23+
$environment = Zend_Registry::get('configGlobal')->environment;
24+
$this->_environment=$environment;
25+
$this->Component->NotifyError->initNotifier(
26+
$environment,
27+
$error,
28+
$mailer,
29+
$session,
30+
$profiler,
31+
$_SERVER
32+
);
1333

14-
parent::init();
15-
$error = $this->_getParam('error_handler');
16-
if(!isset($error)||empty($error))
17-
{
18-
return;
19-
}
20-
$mailer = new Zend_Mail();
21-
$session = new Zend_Session_Namespace('Auth_User');
22-
$db = Zend_Registry::get('dbAdapter');
23-
$profiler = $db->getProfiler();
24-
$environment = Zend_Registry::get('configGlobal')->environment;
25-
$this->_environment=$environment;
26-
$this->Component->NotifyError->initNotifier(
27-
$environment,
28-
$error,
29-
$mailer,
30-
$session,
31-
$profiler,
32-
$_SERVER
33-
);
34-
35-
$this->_error = $error;
34+
$this->_error = $error;
3635

37-
$this->_environment = $environment;
38-
}
36+
$this->_environment = $environment;
37+
}
3938

4039
public function errorAction()
41-
{
42-
$error = $this->_getParam('error_handler');
43-
if(!isset($error)||empty($error))
44-
{
45-
$this->view->message = 'Page not found';
46-
return;
47-
}
48-
switch ($this->_error->type) {
49-
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
50-
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
51-
$this->getResponse()->setHttpResponseCode(404);
52-
$this->view->message = 'Page not found';
53-
break;
54-
55-
default:
56-
$this->getResponse()->setHttpResponseCode(500);
57-
$this->_applicationError();
58-
break;
59-
}
60-
$fullMessage = $this->Component->NotifyError->getFullErrorMessage();
61-
$this->getLogger()->crit($fullMessage);
40+
{
41+
$error = $this->_getParam('error_handler');
42+
if(!isset($error)||empty($error))
43+
{
44+
$this->view->message = 'Page not found';
45+
return;
46+
}
47+
48+
$controller=$error->request->getParams();
49+
$controller=$controller['controller'];
50+
if($controller!='install'&&!file_exists(BASE_PATH."/application/configs/database.local.ini"))
51+
{
52+
$this->view->message="Midas is not installed. Please go the <a href='{$this->view->webroot}/install'> install page</a>.";
53+
return;
54+
}
55+
switch ($this->_error->type) {
56+
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
57+
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
58+
$this->getResponse()->setHttpResponseCode(404);
59+
$this->view->message = 'Page not found';
60+
break;
61+
62+
default:
63+
$this->getResponse()->setHttpResponseCode(500);
64+
$this->_applicationError();
65+
break;
66+
}
67+
$fullMessage = $this->Component->NotifyError->getFullErrorMessage();
6268
if(isset($this->fullMessage))
6369
{
6470
$this->getLogger()->crit($this->fullMessage);
@@ -67,28 +73,28 @@ public function errorAction()
6773
{
6874
$this->getLogger()->crit($this->view->message);
6975
}
70-
}
76+
}
7177

7278
private function _applicationError()
73-
{
74-
$fullMessage = $this->Component->NotifyError->getFullErrorMessage();
75-
$shortMessage = $this->Component->NotifyError->getShortErrorMessage();
76-
$this->fullMessage=$fullMessage;
77-
78-
switch ($this->_environment) {
79-
case 'production':
80-
$this->view->message = $shortMessage;
81-
break;
82-
case 'testing':
83-
$this->_helper->layout->setLayout('blank');
84-
$this->_helper->viewRenderer->setNoRender();
85-
86-
$this->getResponse()->appendBody($shortMessage);
87-
break;
88-
default:
89-
$this->view->message = nl2br($fullMessage);
90-
}
91-
92-
$this->Component->NotifyError->notify();
93-
}
79+
{
80+
$fullMessage = $this->Component->NotifyError->getFullErrorMessage();
81+
$shortMessage = $this->Component->NotifyError->getShortErrorMessage();
82+
$this->fullMessage=$fullMessage;
83+
84+
switch ($this->_environment) {
85+
case 'production':
86+
$this->view->message = $shortMessage;
87+
break;
88+
case 'testing':
89+
$this->_helper->layout->setLayout('blank');
90+
$this->_helper->viewRenderer->setNoRender();
91+
92+
$this->getResponse()->appendBody($shortMessage);
93+
break;
94+
default:
95+
$this->view->message = nl2br($fullMessage);
96+
}
97+
98+
$this->Component->NotifyError->notify();
99+
}
94100
}

application/controllers/ImportController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
class ImportController extends AppController
88
{
99

10-
public $_models=array('Item','Folder','ItemRevision','Assetstore','Folderpolicyuser','Itempolicyuser','Keyword');
11-
public $_daos=array('Item','Folder','ItemRevision','Bitstream','Assetstore','Keyword');
10+
public $_models=array('Item','Folder','ItemRevision','Assetstore','Folderpolicyuser','Itempolicyuser','ItemKeyword');
11+
public $_daos=array('Item','Folder','ItemRevision','Bitstream','Assetstore','ItemKeyword');
1212
public $_components=array('Upload','Utility');
1313
public $_forms=array('Import','Assetstore');
1414

0 commit comments

Comments
 (0)