first commit
This commit is contained in:
131
apps/update/modules/stRepairKit/actions/actions.class.php
Normal file
131
apps/update/modules/stRepairKit/actions/actions.class.php
Normal file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
class stRepairKitActions extends sfActions
|
||||
{
|
||||
/**
|
||||
*
|
||||
* Baza danych
|
||||
*
|
||||
* @var sfDatabaseManager
|
||||
*/
|
||||
protected $dbm = null;
|
||||
|
||||
public function executeIndex()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Naprawa zagnieżdżeń kategorii
|
||||
*
|
||||
*/
|
||||
public function executeRepairCategories()
|
||||
{
|
||||
stRepairKitProgressBar::cleanSession(stRepairKitProgressBar::CATEGORY_NAMESPACE);
|
||||
|
||||
$select = new Criteria();
|
||||
|
||||
$select->add(CategoryPeer::PARENT_ID, null, Criteria::ISNOTNULL);
|
||||
|
||||
$update = new Criteria();
|
||||
|
||||
$update->add(CategoryPeer::SCOPE, null);
|
||||
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$category = BasePeer::doUpdate($select, $update, $con);
|
||||
|
||||
$this->steps = CategoryPeer::doCount(new Criteria());
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(CategoryPeer::PARENT_ID, null, Criteria::ISNULL);
|
||||
|
||||
$c->addAscendingOrderByColumn(CategoryPeer::LFT);
|
||||
|
||||
$roots = CategoryPeer::doSelect($c);
|
||||
|
||||
foreach ($roots as $root)
|
||||
{
|
||||
$root->setCulture('pl_PL');
|
||||
|
||||
$root->setLft(null);
|
||||
|
||||
$root->makeRoot();
|
||||
|
||||
$root->setScope($root->getId());
|
||||
|
||||
$root->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function executeRepairAssetFolders()
|
||||
{
|
||||
stRepairKitProgressBar::cleanSession(stRepairKitProgressBar::ASSET_FOLDER_NAMESPACE);
|
||||
|
||||
$select = new Criteria();
|
||||
|
||||
$select->add(sfAssetFolderPeer::TREE_PARENT, null, Criteria::ISNOTNULL);
|
||||
|
||||
$update = new Criteria();
|
||||
|
||||
$update->add(sfAssetFolderPeer::STATIC_SCOPE, null);
|
||||
|
||||
$con = Propel::getConnection();
|
||||
|
||||
$category = BasePeer::doUpdate($select, $update, $con);
|
||||
|
||||
$this->steps = sfAssetFolderPeer::doCount(new Criteria());
|
||||
|
||||
$c = new Criteria();
|
||||
|
||||
$c->add(sfAssetFolderPeer::TREE_PARENT, null, Criteria::ISNULL);
|
||||
|
||||
$c->addAscendingOrderByColumn(sfAssetFolderPeer::ID);
|
||||
|
||||
$roots = sfAssetFolderPeer::doSelect($c);
|
||||
|
||||
foreach ($roots as $root)
|
||||
{
|
||||
$root->setTreeLeft(null);
|
||||
|
||||
$root->makeRoot();
|
||||
|
||||
$root->setStaticScope($root->getId());
|
||||
|
||||
$root->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Inicjalizacja połączenia bazą danych i załadowanie konfiguracji wszystkich pluginów
|
||||
*
|
||||
*/
|
||||
public function preExecute()
|
||||
{
|
||||
|
||||
sfLoader::loadPluginConfig();
|
||||
|
||||
$this->dbm = new sfDatabaseManager();
|
||||
|
||||
$this->dbm->initialize();
|
||||
|
||||
parent::preExecute();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Zamknięcie połączenia z bazą danych
|
||||
*
|
||||
*/
|
||||
public function postExecute()
|
||||
{
|
||||
$this->dbm->shutdown();
|
||||
|
||||
parent::postExecute();
|
||||
}
|
||||
}
|
||||
?>
|
||||
2
apps/update/modules/stRepairKit/config/security.yml
Normal file
2
apps/update/modules/stRepairKit/config/security.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
all:
|
||||
is_secure: on
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php use_helper('Url') ?>
|
||||
<h1><?php echo __('Moduł naprawy') ?></h1>
|
||||
<ul>
|
||||
<li><?php echo link_to(__('Naprawa katalogu zdjęć'),'stRepairKit/repairAssetFolders') ?></li>
|
||||
|
||||
<li><?php echo link_to(__('Naprawa zagnieżdzeń kategorii'),'stRepairKit/repairCategories') ?></li>
|
||||
</ul>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php use_helper('stProgressBar'); ?>
|
||||
|
||||
<?php echo progress_bar('stRepairKit', 'stRepairKitProgressBar', 'repairAssetFolders', $steps); ?>
|
||||
|
||||
<div id="stMigration-multiProgressBar"></div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php use_helper('stProgressBar'); ?>
|
||||
|
||||
<?php echo progress_bar('stRepairKit', 'stRepairKitProgressBar', 'repairCategories', $steps); ?>
|
||||
|
||||
<div id="stMigration-multiProgressBar"></div>
|
||||
Reference in New Issue
Block a user