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

Commit a4c1a86

Browse files
author
Jamie Snape
committed
Store default asset store id in database
1 parent c22cd88 commit a4c1a86

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

core/configs/application.ini

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ application.description =
1111
application.lang = "en"
1212
; session lifetime (minutes)
1313
session.lifetime = "20"
14-
; default asset store
15-
defaultassetstore.id =
1614
; default time zone
1715
default.timezone = "America/New_York"
1816
; default license

core/controllers/AdminController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
class AdminController extends AppController
2525
{
26-
public $_models = array('Assetstore', 'Bitstream', 'Item', 'ItemRevision', 'Folder', 'License');
26+
public $_models = array('Assetstore', 'Bitstream', 'Item', 'ItemRevision', 'Folder', 'License', 'Setting');
2727
public $_daos = array();
2828
public $_components = array('Upgrade', 'Utility', 'MIDAS2Migration');
2929
public $_forms = array('Admin', 'Assetstore', 'Migrate');
@@ -187,7 +187,7 @@ public function indexAction()
187187
if (!$defaultSet) {
188188
foreach ($assetstores as $key => $assetstore) {
189189
$assetstores[$key]->default = true;
190-
$config->global->defaultassetstore->id = $assetstores[$key]->getKey();
190+
$this->Setting->setConfig('default_assetstore', $assetstores[$key]->getKey());
191191

192192
$writer = new Zend_Config_Writer_Ini();
193193
$writer->setConfig($config);

core/controllers/InstallController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
class InstallController extends AppController
2525
{
26-
public $_models = array('User', 'Assetstore');
26+
public $_models = array('User', 'Assetstore', 'Setting');
2727
public $_daos = array('Assetstore');
2828
public $_components = array('Random', 'Utility');
2929
public $_forms = array('Install');
@@ -268,14 +268,15 @@ public function step3Action()
268268
$config->global->application->lang = $form->getValue('lang');
269269
$config->global->application->name = $form->getValue('name');
270270
$config->global->default->timezone = $form->getValue('timezone');
271-
$config->global->defaultassetstore->id = $assetstores[0]->getKey();
272271
$config->global->environment = 'production';
273272

274273
$writer = new Zend_Config_Writer_Ini();
275274
$writer->setConfig($config);
276275
$writer->setFilename(APPLICATION_CONFIG);
277276
$writer->write();
278277

278+
$this->Setting->setConfig('default_assetstore', $assetstores[0]->getKey());
279+
279280
$this->redirect('/admin#tabs-modules');
280281
}
281282
}

modules/demo/controllers/components/DemoComponent.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,12 @@ public function reset()
8080
$assetstoreDao->setType(MIDAS_ASSETSTORE_LOCAL);
8181
$assetstoreModel->save($assetstoreDao);
8282

83+
/** @var SettingModel $settingModel */
84+
$settingModel = MidasLoader::loadModel('Setting');
85+
$settingModel->setConfig('default_assetstore', $assetstoreDao->getKey());
86+
8387
$options = array('allowModifications' => true);
8488
$config = new Zend_Config_Ini(CORE_CONFIGS_PATH.'/application.ini', null, $options);
85-
$config->global->defaultassetstore->id = $assetstoreDao->getKey();
8689
$config->global->dynamichelp = 1;
8790
$config->global->environment = 'production';
8891
$config->global->application->name = 'Midas Platform - Demo';

0 commit comments

Comments
 (0)