Ours not to question why
Ours but to do or die
Lord Tennyson, asked about Magento core team's code

Friday 17 August 2012

Uninstall Aitoc module

Step 1:


Drop all tables with "Aitoc_" prefix

DROP TABLE Aitoc_TableName;

Step 2:


Delete/Rename/Move files from app/code/local/Aitoc/* 
Delete/Rename/Move directory app/code/local/Aitoc

Step 3:


After doing steps above, I got this error:

Warning: Varien_Autoload::include(Aitoc/Aitsys/Model/Init/Processor.php) [varien-autoload.include]: failed to open stream: No such file or directory in /home/devel/www/lib/Varien/Autoload.php on line 93


Warning: Varien_Autoload::include() [function.include]: Failed opening 'Aitoc/Aitsys/Model/Init/Processor.php' for inclusion (include_path='/home/devel/www/app/code/local:/home/devel/www/app/code/community:/home/devel/www/app/code/core:/home/devel/www/lib:.:/usr/share/php:/usr/share/pear') in /home/devel/www/lib/Varien/Autoload.php on line 93


Fatal error: Class 'Aitoc_Aitsys_Model_Init_Processor' not found in /home/devel/www/app/code/local/Mage/Core/Model/App.php on line 6


At first, I didn't noticed a little detail:

/home/devel/www/app/code/LOCAL/Mage/Core/Model/App.php on line 6


That Aitoc, insolently overwrites Core_Model_App.
So the most important step, for me, is to REMOVE IT, with no mercy.

Tuesday 14 August 2012

Magento Upgrade

Step 1:

  • Make sure you have set this in 
errors/local.xml
<config>
...
    print
  • Rename or delete maintenance.flag file
  • Or add exception for maintenance in index.php:
$ip = $_SERVER['REMOTE_ADDR'];

if (file_exists($maintenanceFile) && $ip != your.ip.addr.ess) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}
  • Uncomment this line in index.php
ini_set('display_errors', 1);


Step2:

> find . -type f -exec chmod 777 {} \;
> find . -type d -exec chmod 777 {} \;
rm -rf var/cache/* var/session/*
chmod 550 ./mage
./mage mage-setup .
./mage config-set preferred_state stable
./mage list-installed
./mage list-upgrades
./mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force
php shell/indexer.php reindexall
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
> chmod o+w var var/.htaccess app/etc
> chmod -R o+w media

Couple tips:

To  reindex only specific index
php shell/indexer.php --reindex index_name

    for 'index_name' put one of those:

catalog_product_attribute Product Attributes
catalog_product_price Product Prices
catalog_url Catalog Url Rewrites
catalog_product_flat Product Flat Data
catalog_category_flat Category Flat Data
catalog_category_product Category Products
catalogsearch_fulltext Catalog Search Index
cataloginventory_stock Stock status

To uninstall community module:
./mage uninstall community Module_Name


Step 3:

Errors, errors, errors...


Errors I've faced:


ERROR:  Base table or view already exists: 1050 Table ‘some_table_name’ already exists

Solution:

Well... Actually, don't be afraid to comment out the code where the table is being created. That works for me, because I get this error mainly because I've created some of the tables by hand or used db-repair. This can also happen when some upgrade gone wrong before, and database was partly upgraded.
You can find the file where the table is created in error log, it will look something like this:
app/code/core/Mage/Somefolder/sql/some_setup/upgrade-1.5...-1.6


Column not found: 1054 Unknown column 'website_date' in 'field list'' in...


Solution:
DROP TABLE `catalog_product_index_website`;
CREATE TABLE `catalog_product_index_website` (
  `website_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Website ID',
  `website_date` date DEFAULT NULL COMMENT 'Website Date',
  `rate` float DEFAULT '1' COMMENT 'Rate',
  PRIMARY KEY (`website_id`),
  KEY `IDX_CATALOG_PRODUCT_INDEX_WEBSITE_WEBSITE_DATE` (`website_date`),
  CONSTRAINT `FK_CAT_PRD_IDX_WS_WS_ID_CORE_WS_WS_ID` FOREIGN KEY (`website_id`) REFERENCES `core_website` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Catalog Product Website Index Table';


Insert value list does not match column list: 1136 Column count doesn't match value count at row 1' in...


Solution:
  1.  I recommend to use db-repair in this case. 
    It is available to download from: http://www.magentocommerce.com/download
    If you have any difficulties: 
    magentocommerce db-repair-tool tutorial
  2.  You can also update the database by yourself.
    Using www.magereverse.com


General error: 1025 Error on rename of './.../#sql-3ce6_110ef5d' to './.../customer_entity_datetime' (errno: 150)


Solution:

If you really don't want to use the solution above ↑ ,
this is what I've found:
http://technooze.com/blog/92/114/magento-index-management-Cannot-initialize-the-indexer-process
http://www.devraju.com/magento/upgrading-magento-1-4-2-0-to-1-6-1-0/



Column "date" does not exists on table "catalog_product_index_website"


Solution:
Coment out following code:
/**
$installer->getConnection()->changeColumn(
    $installer->getTable('catalog/product_index_website'),
    'date',
    'website_date',
    array(
        'type'      => Varien_Db_Ddl_Table::TYPE_DATE,
        'comment'   => 'Website Date'
    )
);
**/
 
src: http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/magento_1.5_to_1.6_upgrade#column_date_does_not_exists_on_table_catalog_product_index_website



Invalid backend model specified: customer_entity/address_attribute_backend_region


In table eav_attribute, change every backend_model value beggining with customer_entity/* to customer/entity_*

src: http://www.magentocommerce.com/boards/viewreply/350593/




This post will be updated with every next upgrade I make ;)