mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 07:12:15 +09:00
First step of reorganizing admin module into namespaces
This commit is contained in:
parent
4c65499ab1
commit
93947a7f51
10 changed files with 722 additions and 1194 deletions
63
modules/admin/controllers/Install.php
Normal file
63
modules/admin/controllers/Install.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
namespace Rhymix\Modules\Admin\Controllers;
|
||||
|
||||
use Rhymix\Framework\DB;
|
||||
use Rhymix\Modules\Admin\Models\Favorite as FavoriteModel;
|
||||
|
||||
class Install extends Base
|
||||
{
|
||||
/**
|
||||
* Install module
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function moduleInstall()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if update is necessary
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkUpdate()
|
||||
{
|
||||
$oDB = DB::getInstance();
|
||||
if (!$oDB->isColumnExists('admin_favorite', 'type'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update module
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function moduleUpdate()
|
||||
{
|
||||
$oDB = DB::getInstance();
|
||||
if (!$oDB->isColumnExists('admin_favorite', 'type'))
|
||||
{
|
||||
$output = FavoriteModel::getFavorites();
|
||||
$favorites = $output->get('favorites');
|
||||
|
||||
$oDB->dropColumn('admin_favorite', 'admin_favorite_srl');
|
||||
$oDB->addColumn('admin_favorite', 'admin_favorite_srl', 'number', null, 0);
|
||||
$oDB->addColumn('admin_favorite', 'type', 'varchar', 30, 'module');
|
||||
if (is_array($favorites))
|
||||
{
|
||||
$oAdminAdminController = getAdminController('admin');
|
||||
$oAdminAdminController->_deleteAllFavorite();
|
||||
foreach($favorites as $value)
|
||||
{
|
||||
$oAdminAdminController->_insertFavorite(0, $value->module);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue