Skip to content

Instantly share code, notes, and snippets.

View satishgumudavelli's full-sized avatar
🏠
Working from home

Satish Gumudavelly satishgumudavelli

🏠
Working from home
View GitHub Profile
<?php
/* create class */
class Record {
/* record information will be held in here */
private $info;
/* constructor */
function Record($record_array) {
$this->info = $record_array;
<?php
function __backup_mysql_database($params)
{
$mtables = array(); $contents = "-- Database: `".$params['db_to_backup']."` --\n";
$mysqli = new mysqli($params['db_host'], $params['db_uname'], $params['db_password'], $params['db_to_backup']);
if ($mysqli->connect_error) {
die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}
<?php
function &backup_tables($host, $user, $pass, $name, $tables = '*'){
$data = "\n/*---------------------------------------------------------------".
"\n SQL DB BACKUP ".date("d.m.Y H:i")." ".
"\n HOST: {$host}".
"\n DATABASE: {$name}".
"\n TABLES: {$tables}".
"\n ---------------------------------------------------------------*/\n";
$link = mysql_connect($host,$user,$pass);
mysql_select_db($name,$link);
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
Mage::app();
$entity_type_id = Mage::getModel('catalog/product')->getResource()->getTypeId();
prepareCollection($entity_type_id);
function prepareCollection($ent_type_id){
$resource = Mage::getSingleton('core/resource');
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once 'app/Mage.php';
Mage::app();
// $fileName = MAGENTO . '/var/import/importAttrib.csv';
$fileName = 'importAttrib.csv';
// getCsv($fileName);
getAttributeCsv($fileName);
function getAttributeCsv($fileName){
https://github.com/magento/magento2/issues/13131
@satishgumudavelli
satishgumudavelli / Magento 2 cookie.php
Last active December 17, 2018 05:46
How to create cookie in Magento 2
<?php
@ini_set('max_execution_time', -1);
@ini_set('memory_limit', '-1');
/**
* PHP File Manager v1.2
* https://github.com/alexantr/filemanager
<?php
@ini_set('max_execution_time', -1);
@ini_set('memory_limit', '-1');
/**
* PHP File Manager v1.2
* https://github.com/alexantr/filemanager
@satishgumudavelli
satishgumudavelli / SetupUpgrade.php
Created June 11, 2019 07:21
Magento 2 setup upgrade with script
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
use Magento\Framework\App\Bootstrap;
include('app/bootstrap.php');