Skip to content

Commit 92dda62

Browse files
author
Magepow
committed
Init commit
0 parents  commit 92dda62

10 files changed

+333
-0
lines changed

.gitignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# General
2+
.DS_Store
3+
.AppleDouble
4+
.LSOverride
5+
6+
# Icon must end with two \r
7+
Icon
8+
9+
# Thumbnails
10+
._*
11+
12+
# Files that might appear in the root of a volume
13+
.DocumentRevisions-V100
14+
.fseventsd
15+
.Spotlight-V100
16+
.TemporaryItems
17+
.Trashes
18+
.VolumeIcon.icns
19+
.com.apple.timemachine.donotpresent
20+
21+
# Directories potentially created on remote AFP share
22+
.AppleDB
23+
.AppleDesktop
24+
Network Trash Folder
25+
Temporary Items
26+
.apdisk

addAttribute.php

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/app/bootstrap.php';
4+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
5+
6+
class Outslide extends \Magento\Framework\App\Http
7+
implements \Magento\Framework\AppInterface {
8+
public function launch()
9+
{
10+
$setup = $this->_objectManager->create('\Magento\Framework\Setup\ModuleDataSetupInterface');
11+
$eavSetupFactory = $this->_objectManager->create('\Magento\Eav\Setup\EavSetupFactory');
12+
$eavSetup = $eavSetupFactory->create(['setup' => $setup]);
13+
14+
$eavSetup->addAttribute(
15+
\Magento\Catalog\Model\Product::ENTITY,
16+
'test_attribute',
17+
[
18+
'group' => 'General',
19+
'type' => 'int',
20+
'backend' => '',
21+
'frontend' => '',
22+
'label' => 'Test Attribute',
23+
'input' => 'boolean',
24+
'class' => '',
25+
'source' => '',
26+
'global' => \Magento\Catalog\Model\ResourceModel\Eav\Attribute::SCOPE_STORE,
27+
'visible' => true,
28+
'required' => false,
29+
'user_defined' => true,
30+
'default' => '',
31+
'searchable' => false,
32+
'filterable' => false,
33+
'comparable' => false,
34+
'visible_on_front' => false,
35+
'used_in_product_listing' => true,
36+
'unique' => false,
37+
'apply_to' => 'simple,configurable,virtual,bundle,downloadable'
38+
]
39+
);
40+
41+
echo 'Done!';
42+
//the method must end with this line
43+
return $this->_response;
44+
}
45+
}
46+
47+
/** @var \Magento\Framework\App\Http $app */
48+
$app = $bootstrap->createApplication('Outslide');
49+
$bootstrap->run($app);

addAttributeOption.php

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
require dirname(__FILE__) . '/app/bootstrap.php';
3+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
4+
5+
class Outslide extends \Magento\Framework\App\Http
6+
implements \Magento\Framework\AppInterface {
7+
public function launch()
8+
{
9+
$setup = $this->_objectManager->create('\Magento\Framework\Setup\ModuleDataSetupInterface');
10+
$eavSetupFactory = $this->_objectManager->create('\Magento\Eav\Setup\EavSetupFactory');
11+
$eavSetup = $eavSetupFactory->create(['setup' => $setup]);
12+
13+
$attributeId = $eavSetup->getAttributeId('catalog_product', 'manufacturer');
14+
$options = [
15+
'values' => [
16+
'1' => 'brand 1',
17+
'2' => 'brand 2',
18+
'3' => 'brand 3',
19+
],
20+
'attribute_id' => $attributeId ,
21+
];
22+
23+
$eavSetup->addAttributeOption($options);
24+
25+
echo 'Done';
26+
//the method must end with this line
27+
return $this->_response;
28+
}
29+
}
30+
31+
/** @var \Magento\Framework\App\Http $app */
32+
$app = $bootstrap->createApplication('changeConfig');
33+
$bootstrap->run($app);

addSchema.php

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
use Magento\Framework\DB\Ddl\Table;
4+
5+
require dirname(__FILE__) . '/app/bootstrap.php';
6+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
7+
8+
class Outslide extends \Magento\Framework\App\Http
9+
implements \Magento\Framework\AppInterface {
10+
public function launch()
11+
{
12+
$installer = $this->_objectManager->create('\Magento\Setup\Module\Setup');
13+
14+
$installer->startSetup();
15+
16+
$table = $installer->getConnection()
17+
->newTable($installer->getTable('magepow_comments'))
18+
->addColumn(
19+
'comment_id',
20+
Table::TYPE_INTEGER,
21+
null,
22+
['identity' => true, 'nullable' => false, 'primary' => true],
23+
'Comment ID'
24+
)
25+
->addColumn('title', Table::TYPE_TEXT, 255, ['nullable' => true, 'default' => null], 'Title')
26+
->addColumn('status', Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '1'], 'Status')
27+
->addColumn('store', Table::TYPE_TEXT, 255, ['nullable' => true, 'default' => '0'])
28+
->addColumn('created_time', Table::TYPE_TIMESTAMP, null, ['nullable' => false, 'default' => Table::TIMESTAMP_INIT], 'Created Time')
29+
->addColumn('update_time', Table::TYPE_DATETIME, null, ['nullable' => true, 'default' => null], 'Update Time')
30+
->addIndex($installer->getIdxName('comment_id', ['comment_id']), ['comment_id'])
31+
->setComment('Magepow Comments');
32+
33+
$installer->getConnection()->createTable($table);
34+
35+
$installer->endSetup();
36+
37+
echo 'Done!';
38+
//the method must end with this line
39+
return $this->_response;
40+
}
41+
}
42+
43+
/** @var \Magento\Framework\App\Http $app */
44+
$app = $bootstrap->createApplication('Outslide');
45+
$bootstrap->run($app);

addSchemaModule.php

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/app/bootstrap.php';
4+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
5+
6+
class Outslide extends \Magento\Framework\App\Http
7+
implements \Magento\Framework\AppInterface {
8+
public function launch()
9+
{
10+
$installSchema = $this->_objectManager->create('\Magepow\ModuleName\Setup\InstallSchema');
11+
$context = $this->_objectManager->create('\Magento\Setup\Model\ModuleContext', ['version' => '1.0.0']);
12+
$setup = $this->_objectManager->create('\Magento\Setup\Module\Setup');
13+
$installSchema->install($setup, $context);
14+
15+
echo 'Done!';
16+
//the method must end with this line
17+
return $this->_response;
18+
}
19+
}
20+
21+
/** @var \Magento\Framework\App\Http $app */
22+
$app = $bootstrap->createApplication('Outslide');
23+
$bootstrap->run($app);

deleteCategory.php

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/app/bootstrap.php';
4+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
5+
6+
class Outslide extends \Magento\Framework\App\Http
7+
implements \Magento\Framework\AppInterface {
8+
public function launch()
9+
{
10+
$ids = [10, 15, 20];
11+
$categoryFactory = $this->_objectManager->get('Magento\Catalog\Model\CategoryFactory');
12+
$_MyClass = $this->_objectManager->create('DeleteCategory');
13+
$_MyClass->deleteCategories($ids);
14+
return $this->_response;
15+
}
16+
17+
public function catchException(\Magento\Framework\App\Bootstrap $bootstrap, \Exception $exception)
18+
{
19+
return false;
20+
}
21+
22+
}
23+
24+
25+
class DeleteCategory{
26+
27+
protected $_objectManager;
28+
protected $_registry;
29+
30+
public function __construct(
31+
\Magento\Framework\Registry $registry
32+
)
33+
{
34+
$this->_registry = $registry;
35+
$this->_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
36+
}
37+
38+
public function deleteCategories($ids = array()) {
39+
$categoryFactory = $this->_objectManager->get('Magento\Catalog\Model\CategoryFactory');
40+
$categories = $categoryFactory->create();
41+
$collection = $categories->getCollection()->addAttributeToSelect('name');
42+
$this->_registry->register("isSecureArea", true);
43+
foreach($collection as $category) {
44+
if(is_array($ids) && in_array($category->getId(), $ids))
45+
{
46+
$category->delete();
47+
echo 'category ' . $category->getName() . ' deleted';
48+
} else if($category->getId() == $ids) {
49+
$category->delete();
50+
echo 'category ' . $category->getName() . ' deleted';
51+
}
52+
}
53+
}
54+
55+
}
56+
57+
/** @var \Magento\Framework\App\Http $app */
58+
$app = $bootstrap->createApplication('Outslide');
59+
$bootstrap->run($app);

removeAttribute.php

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/app/bootstrap.php';
4+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
5+
6+
class Outslide extends \Magento\Framework\App\Http
7+
implements \Magento\Framework\AppInterface {
8+
public function launch()
9+
{
10+
$setup = $this->_objectManager->create('\Magento\Framework\Setup\ModuleDataSetupInterface');
11+
$eavSetupFactory = $this->_objectManager->create('\Magento\Eav\Setup\EavSetupFactory');
12+
$eavSetup = $eavSetupFactory->create(['setup' => $setup]);
13+
14+
$eavSetup->removeAttribute(
15+
\Magento\Catalog\Model\Product::ENTITY,
16+
'test_attribute'
17+
);
18+
19+
echo 'Done!';
20+
//the method must end with this line
21+
return $this->_response;
22+
}
23+
}
24+
25+
/** @var \Magento\Framework\App\Http $app */
26+
$app = $bootstrap->createApplication('Outslide');
27+
$bootstrap->run($app);

removeAttributeCategory.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/app/bootstrap.php';
4+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
5+
6+
class Outslide extends \Magento\Framework\App\Http
7+
implements \Magento\Framework\AppInterface {
8+
public function launch()
9+
{
10+
$setup = $this->_objectManager->create('\Magento\Framework\Setup\ModuleDataSetupInterface');
11+
$categorySetupFactory = $this->_objectManager->create('\Magento\Catalog\Setup\CategorySetupFactory');
12+
$categorySetup = $categorySetupFactory->create(['setup' => $setup]);
13+
14+
$categorySetup->removeAttribute( \Magento\Catalog\Model\Product::ENTITY, 'extrafee');
15+
16+
echo 'Done!';
17+
//the method must end with this line
18+
return $this->_response;
19+
}
20+
}
21+
22+
/** @var \Magento\Framework\App\Http $app */
23+
$app = $bootstrap->createApplication('Outslide');
24+
$bootstrap->run($app);

renameAttribute.php

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/app/bootstrap.php';
4+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
5+
6+
class Outslide extends \Magento\Framework\App\Http
7+
implements \Magento\Framework\AppInterface {
8+
public function launch()
9+
{
10+
11+
$setup = $this->_objectManager->create('\Magento\Framework\Setup\ModuleDataSetupInterface');
12+
13+
$eavSetup = $this->_objectManager->get('Magento\Eav\Setup\EavSetupFactory');
14+
15+
$catalogSetup = $eavSetup->create(['setup' => $setup]);
16+
$catalogSetup->updateAttribute('catalog_product', 'demo_url', array('attribute_code' => 'demo_frontend'));
17+
18+
echo 'Done!';
19+
//the method must end with this line
20+
return $this->_response;
21+
}
22+
}
23+
24+
/** @var \Magento\Framework\App\Http $app */
25+
$app = $bootstrap->createApplication('Outslide');
26+
$bootstrap->run($app);

updateConfig.php

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/app/bootstrap.php';
4+
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
5+
6+
class Outslide extends \Magento\Framework\App\Http
7+
implements \Magento\Framework\AppInterface {
8+
public function launch()
9+
{
10+
$config = $this->_objectManager->create('\Magento\Config\Model\ResourceModel\Config');
11+
$config->saveConfig('web/unsecure/base_url', 'http://magepow.com/',\Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT,0);
12+
13+
echo 'Done!';
14+
//the method must end with this line
15+
return $this->_response;
16+
}
17+
}
18+
19+
/** @var \Magento\Framework\App\Http $app */
20+
$app = $bootstrap->createApplication('Outslide');
21+
$bootstrap->run($app);

0 commit comments

Comments
 (0)