[-] MO: fix blocktopmenu install

This commit is contained in:
rMalie
2011-10-11 11:28:31 +00:00
parent 17b8a076a0
commit 172efaabd7
4 changed files with 22 additions and 17 deletions
+1 -1
View File
@@ -235,7 +235,7 @@
'CacheCore' => 'classes/cache/Cache.php',
'Cache' => 'override/classes/cache/Cache.php',
'CacheApcCore' => 'classes/cache/CacheApc.php',
'CacheApc' => '',
'CacheApc' => 'override/classes/cache/CacheApc.php',
'CacheFsCore' => 'classes/cache/CacheFs.php',
'CacheFs' => 'override/classes/cache/CacheFs.php',
'CacheMemcacheCore' => 'classes/cache/CacheMemcache.php',
+2 -2
View File
@@ -156,7 +156,7 @@ abstract class ModuleCore
SELECT `id_module`
FROM `'._DB_PREFIX_.'module`
WHERE `name` = \''.pSQL($this->name).'\'');
if ($result)
if (0&&$result)
return false;
$result = Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->table, array('name' => $this->name, 'active' => 1), 'INSERT');
@@ -658,7 +658,7 @@ abstract class ModuleCore
else
$errors[] = sprintf(Tools::displayError('%1$s (parse error in %2$s)'), $module, substr($filepath, strlen(_PS_ROOT_DIR_)));
}
if (class_exists($module,false))
{
$moduleList[$moduleListCursor++] = new $module;
+6 -1
View File
@@ -180,7 +180,7 @@ abstract class DbCore
public static function getClass()
{
$class = 'MySQL';
if (class_exists('mysqli', false))
if (0&&class_exists('mysqli', false))
$class = 'DbMySQLi';
return $class;
}
@@ -361,6 +361,11 @@ abstract class DbCore
public function executeS($sql, $array = true, $use_cache = 1)
{
$sql = (string)$sql;
// This methode must be used only with queries which display results
if (!preg_match('#^\s*(select|show|explain)\s#i', $sql))
throw new PrestashopDatabaseException('Db->executeS() must be used only with select, show or explain queries');
$this->result = false;
$this->last_query = $sql;
if ($use_cache && _PS_CACHE_ENABLED_ && $array && ($result = Cache::getInstance()->get(md5($sql))))
+13 -13
View File
@@ -17,10 +17,10 @@ class blocktopmenu extends Module
public function install()
{
if(!parent::install() ||
!$this->registerHook('top') ||
!Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', 'CAT1,CMS1,CMS2,PRD1') ||
!Configuration::updateValue('MOD_BLOCKTOPMENU_SEARCH', '1') ||
if(!parent::install() ||
!$this->registerHook('top') ||
!Configuration::updateValue('MOD_BLOCKTOPMENU_ITEMS', 'CAT1,CMS1,CMS2,PRD1') ||
!Configuration::updateValue('MOD_BLOCKTOPMENU_SEARCH', '1') ||
!$this->installDB())
return false;
return true;
@@ -28,13 +28,13 @@ class blocktopmenu extends Module
public function installDb()
{
Db::getInstance()->executeS('
Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop` (
`id_link` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`new_window` TINYINT( 1 ) NOT NULL,
`link` VARCHAR( 128 ) NOT NULL
) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;');
Db::getInstance()->executeS('
Db::getInstance()->execute('
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'linksmenutop_lang` (
`id_link` INT NOT NULL ,
`id_lang` INT NOT NULL ,
@@ -46,9 +46,9 @@ class blocktopmenu extends Module
public function uninstall()
{
if(!parent::uninstall() ||
!Configuration::deleteByName('MOD_BLOCKTOPMENU_ITEMS') ||
!Configuration::deleteByName('MOD_BLOCKTOPMENU_SEARCH') ||
if(!parent::uninstall() ||
!Configuration::deleteByName('MOD_BLOCKTOPMENU_ITEMS') ||
!Configuration::deleteByName('MOD_BLOCKTOPMENU_SEARCH') ||
!$this->uninstallDB())
return false;
return true;
@@ -56,8 +56,8 @@ class blocktopmenu extends Module
private function uninstallDb()
{
Db::getInstance()->executeS('DROP TABLE `'._DB_PREFIX_.'linksmenutop`');
Db::getInstance()->executeS('DROP TABLE `'._DB_PREFIX_.'linksmenutop_lang`');
Db::getInstance()->execute('DROP TABLE `'._DB_PREFIX_.'linksmenutop`');
Db::getInstance()->execute('DROP TABLE `'._DB_PREFIX_.'linksmenutop_lang`');
return true;
}
@@ -156,7 +156,7 @@ class blocktopmenu extends Module
// END Menu Top Links
$this->_html .= '</select><br />
<br />
<a href="#" id="addItem" style="border: 1px solid rgb(170, 170, 170); margin: 2px; padding: 2px; text-align: center; display: block; text-decoration: none; background-color: rgb(250, 250, 250); color: rgb(18, 52, 86);">&lt;&lt; '.$this->l('Add').'</a>
<a href="#" id="addItem" style="border: 1px solid rgb(170, 170, 170); margin: 2px; padding: 2px; text-align: center; display: block; text-decoration: none; background-color: rgb(250, 250, 250); color: rgb(18, 52, 86);">&lt;&lt; '.$this->l('Add').'</a>
</td>
</tr>
</tbody>
@@ -247,7 +247,7 @@ class blocktopmenu extends Module
</p>
</form>
</fieldset><br />';
$this->_html .= '
<fieldset>
<legend><img src="../img/admin/details.gif" alt="" title="" />'.$this->l('List Menu Top Link').'</legend>