Last active
August 29, 2015 13:57
-
-
Save mklooss/9761198 to your computer and use it in GitHub Desktop.
Dummy Installer Element for Magento
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $installer = $this; | |
| /* @var Loewenstark_Dummy_Model_Resource_Setup $installer */ | |
| $installer->startSetup(); | |
| $mail = ''; | |
| $name = ''; | |
| $company = ''; | |
| $phone = ''; | |
| $fax = ''; | |
| $street = ''; | |
| $zip = ''; | |
| $city = ''; | |
| $country = ''; | |
| $locale = ''; | |
| $package = ''; | |
| $theme = ''; | |
| $config = array( | |
| 'web/url/redirect_to_base' => '301', | |
| 'web/seo/use_rewrites' => 1, | |
| 'design/package/name' => $package, | |
| 'design/theme/default' => $theme, | |
| 'design/head/default_title' => $name, | |
| 'design/head/title_suffix' => ' | '.$name, | |
| 'design/header/logo_alt' => $name, | |
| 'design/footer/copyright' => '© '.date('Y').' '.$company, | |
| 'catalog/frontend_flat/catalog_category' => 1, | |
| 'catalog/frontend_flat/catalog_product' => 1, | |
| 'catalog/search/search_type' => 3, | |
| 'catalog/seo/product_use_categories' => 0, | |
| 'catalog/seo/category_canonical_tag' => 1, | |
| 'catalog/seo/product_canonical_tag' => 1, | |
| 'sitemap/generate/enabled' => 1, | |
| 'system/log/enabled' => 1, | |
| 'catalog/review/allow_guest' => 1, | |
| 'catalog/frontend/flat_catalog_category' => 1, | |
| 'catalog/frontend/flat_catalog_product' => 1, | |
| 'advanced/modules_disable_output/Mage_AdminNotification' => 1, | |
| 'dev/template/allow_symlink' => 1, | |
| 'general/locale/timezone' => 'Europe/Berlin', | |
| 'general/region/display_all' => 0, | |
| 'general/locale/firstday' => 1, | |
| 'general/locale/code' => $locale, | |
| 'currency/options/base' => 'EUR', | |
| 'currency/options/default' => 'EUR', | |
| 'currency/options/allow' => 'EUR', | |
| 'contacts/email/recipient_email' => $mail, | |
| 'trans_email/ident_general/name' => $name, | |
| 'trans_email/ident_general/email' => $mail, | |
| 'trans_email/ident_support/name' => $name, | |
| 'trans_email/ident_support/email' => $mail, | |
| 'trans_email/ident_custom1/email' => $name, | |
| 'trans_email/ident_custom1/email' => $mail, | |
| 'trans_email/ident_custom2/email' => $name, | |
| 'trans_email/ident_custom2/email' => $mail, | |
| 'general/region/state_required' => 'CA,EE,ES,FI,FR,LT,LV,RO,US', | |
| 'general/region/display_all' => 0, | |
| 'general/store_information/name' => $name, | |
| 'general/store_information/phone' => $phone, | |
| 'general/store_information/merchant_country' => $country, | |
| 'general/store_information/address' => $street."\n".$zip.' '.$city, | |
| // imprint | |
| 'general/imprint/shop_name' => $name, | |
| 'general/imprint/company_first' => $company, | |
| 'general/imprint/street' => $street, | |
| 'general/imprint/zip' => $zip, | |
| 'general/imprint/city' => $city, | |
| 'general/imprint/country' => $country, | |
| 'general/imprint/telephone' => $phone, | |
| 'general/imprint/fax' => $fax, | |
| 'general/imprint/email' => $mail, | |
| 'general/imprint/vat_id' => '', | |
| 'general/imprint/register_number' => '', | |
| 'general/imprint/court' => '', | |
| 'general/imprint/owner' => '', | |
| 'general/imprint/ceo' => '', | |
| 'general/imprint/bank_account_owner' => '', | |
| 'general/imprint/bank_account' => '', | |
| 'general/imprint/bank_code_number' => '', | |
| 'general/imprint/bank_name' => '', | |
| 'general/imprint/swift' => '', | |
| 'general/imprint/iban' => '', | |
| 'catalog/vertnav/hide_top' => 0, | |
| ); | |
| foreach($config as $key=>$value) | |
| { | |
| $installer->setConfigData($key, $value); | |
| } | |
| // initial mage setup | |
| if (!$installer->getConfigDataFlag('magesetup/is_initialized')) | |
| { | |
| $params = array( | |
| 'systemconfig' => true, | |
| 'tax' => true, | |
| 'cms' => true, | |
| 'agreements' => true, | |
| 'email' => false, | |
| 'country' => 'de', | |
| 'product_tax_class_target' => 1, | |
| 'customer_tax_class_target' => 5 | |
| ); | |
| Mage::getModel('magesetup/setup')->setup($params, true); | |
| } | |
| // create admin user, if doest not exists | |
| $query = $this->getConnection()->select() | |
| ->from($this->getTable('admin/user'), 'COUNT(*)') | |
| ->where('username = ?', 'loewenstark') | |
| ->limit(1); | |
| if(intval($this->getConnection()->fetchOne($query)) < 1) | |
| { | |
| $installer->run("INSERT INTO {$this->getTable('admin/user')} SELECT | |
| NULL user_id, | |
| 'Loewen' firstname, | |
| 'stark' lastname, | |
| 'mathis.klooss@mage-profis.de' email, | |
| 'loewenstark' username, | |
| 'YYYYYYYYYYYYYYYYYYY' password, | |
| NOW() created, | |
| NULL modified, | |
| NULL logdate, | |
| 0 lognum, | |
| 0 reload_acl_flag, | |
| 1 is_active, | |
| (SELECT MAX(extra) FROM admin_user WHERE extra IS NOT NULL) extra, | |
| NULL rp_token, | |
| NOW() rp_token_created_at; | |
| INSERT into admin_role | |
| SELECT | |
| NULL role_id, | |
| (SELECT role_id FROM {$this->getTable('admin/role')} WHERE role_name = 'Administrators') parent_id, | |
| 2 tree_level, | |
| 0 sort_order, | |
| 'U' role_type, | |
| (SELECT user_id FROM admin_user WHERE username = 'loewenstark') user_id, | |
| 'LOEWENSTARK' role_name"); | |
| } | |
| $installer->endSetup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment