本文整理汇总了PHP中Magmi_Config::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Magmi_Config::getInstance方法的具体用法?PHP Magmi_Config::getInstance怎么用?PHP Magmi_Config::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magmi_Config
的用法示例。
在下文中一共展示了Magmi_Config::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateIndexes
public function updateIndexes()
{
//make sure we are not in session
if (session_id() !== "") {
session_write_close();
}
$magdir = Magmi_Config::getInstance()->getMagentoDir();
$cl = $this->getParam("REINDEX:phpcli") . " {$magdir}/shell/indexer.php";
$idxlstr = $this->getParam("REINDEX:indexes", "");
$idxlist = explode(",", $idxlstr);
if (count($idxlist) == 0) {
$this->log("No indexes selected , skipping reindexing...", "warning");
return true;
}
foreach ($idxlist as $idx) {
$tstart = microtime(true);
$this->log("Reindexing {$idx}....", "info");
$out = shell_exec("{$cl} --reindex {$idx}");
$this->log($out, "info");
$tend = microtime(true);
$this->log("done in " . round($tend - $tstart, 2) . " secs", "info");
if (Magmi_StateManager::getState() == "canceled") {
exit;
}
flush();
}
}
示例2: getMagentoBaseDir
public function getMagentoBaseDir()
{
$magmi_conf = Magmi_Config::getInstance();
$magmi_conf->load();
$mbd = $magmi_conf->get("MAGENTO", "basedir");
unset($magmi_conf);
return $mbd;
}
示例3: getScanDir
public function getScanDir($resolve = true)
{
$scandir = $this->getParam("CSV:basedir", "var/import");
if (!isabspath($scandir)) {
$scandir = abspath($scandir, Magmi_Config::getInstance()->getMagentoDir(), $resolve);
}
return $scandir;
}
示例4: getProfileDir
public function getProfileDir()
{
$subdir = $this->_profile == "default" ? "" : DIRSEP . $this->_profile;
$confdir = Magmi_Config::getInstance()->getConfDir() . "{$subdir}";
if (!file_exists($confdir)) {
@mkdir($confdir, Magmi_Config::getInstance()->getDirMask());
}
return realpath($confdir);
}
示例5: getProfileDir
public function getProfileDir()
{
$subdir = $this->_profile == "default" ? "" : DS . $this->_profile;
$confdir = dirname(dirname(self::$_script)) . DS . "conf{$subdir}";
if (!file_exists($confdir)) {
@mkdir($confdir, Magmi_Config::getInstance()->getDirMask());
}
return realpath($confdir);
}
示例6: getSessionConfig
function getSessionConfig()
{
$conf = Magmi_Config::getInstance();
if (isset($_SESSION['MAGMI_CONFIG_FILE'])) {
$conf->load($_SESSION['MAGMI_CONFIG_FILE']);
} else {
$conf->load();
}
return $conf;
}
示例7: initialize
public final function initialize($params = array())
{
try {
$this->_conf = Magmi_Config::getInstance();
$this->_conf->load();
$this->tprefix = $this->_conf->get("DATABASE", "table_prefix");
$this->_excid = 0;
$this->_initialized = true;
$this->_exceptions = array();
} catch (Exception $e) {
die("Error initializing Engine:{$this->_conf->getConfigFilename()} \n" . $e->getMessage());
}
}
示例8: testExistingProfileFromCustomFile
public function testExistingProfileFromCustomFile()
{
$conf = Magmi_Config::getInstance();
$conf->load(__DIR__ . "/test.ini");
$dp = Magmi_DataPumpFactory::getDataPumpInstance("productimport");
$dp->beginImportSession("xmlimport", "create");
$ep = $dp->getEngine()->getPluginClasses();
$this->assertContains('CategoryImporter', $ep['itemprocessors']);
$this->assertContains('ImageAttributeItemProcessor', $ep['itemprocessors']);
$this->assertContains('ItemIndexer', $ep['itemprocessors']);
$this->assertContains('GenericMapperProcessor', $ep['itemprocessors']);
$dp->endImportSession();
}
示例9: testCatMultiRoot
public function testCatMultiRoot()
{
$conf = Magmi_Config::getInstance();
$conf->load(__DIR__ . "/test.ini");
$dp = Magmi_DataPumpFactory::getDataPumpInstance("productimport");
$reader = new Magmi_CSVReader();
$reader->initialize(array("CSV:filename" => __DIR__ . '/categories/category_multiroot.csv'));
$reader->openCSV();
$reader->getColumnNames();
$dp->beginImportSession("catconf", "create", new FileLogger(__DIR__ . '/test.log'));
while ($item = $reader->getNextRecord()) {
$dp->ingest($item);
}
$dp->endImportSession();
$reader->closeCSV();
}
示例10: checkPluginVersion
public function checkPluginVersion()
{
$pv = $this->_raproxy->getVersion();
if ($pv == '0.0.0') {
$this->log("Remote Agent Not found at " . $this->_raproxy->getRemoteAgentUrl(), "startup");
} else {
$this->log("Remote Agent v{$pv} found at " . $this->_raproxy->getRemoteAgentUrl(), "startup");
}
$cv = Magmi_RemoteAgent::getStaticVersion();
if ($pv < $cv) {
$this->log("Deploying latest v{$cv}");
$ok = $this->deployPlugin(Magmi_Config::getInstance()->getMagentoDir());
if ($ok) {
$cpv = $this->_raproxy->getVersion();
$this->log("Remote Agent v{$cpv} deployed at " . $this->_raproxy->getRemoteAgentUrl(), "startup");
}
}
$this->_active = true;
}
示例11: processItemBeforeId
public function processItemBeforeId(&$item, $params = null)
{
// get list of trimmable columns
$tc = $this->getTrimmableCols($item);
foreach ($tc as $col => $mode) {
// for select, just trim value
if ($mode == "select") {
$item[$col] = trim($item[$col]);
} else {
$sep = Magmi_Config::getInstance()->get("GLOBAL", "mutiselect_sep", ",");
$vt = explode($sep, $item[$col]);
foreach ($vt as &$v) {
$v = trim($v);
}
$item[$col] = implode($sep, $vt);
unset($vt);
}
}
return true;
}
示例12: __construct
public function __construct($user, $pass)
{
parent::__construct();
$this->user = $user;
$this->pass = $pass;
$this->_conf = Magmi_Config::getInstance();
$this->_conf->load();
$host = $this->_conf->get("DATABASE", "host", "localhost");
$dbname = $this->_conf->get("DATABASE", "dbname", "magento");
$user = $this->_conf->get("DATABASE", "user");
$pass = $this->_conf->get("DATABASE", "password");
$port = $this->_conf->get("DATABASE", "port", "3306");
$socket = $this->_conf->get("DATABASE", "unix_socket", false);
try {
$this->initDb($host, $dbname, $user, $pass, $port, $socket);
$this->tablename = $this->_conf->get("DATABASE", "table_prefix") . "admin_user";
$this->_hasDB = true;
} catch (Exception $e) {
$this->_hasDB = false;
}
}
示例13: getRemoteFile
public function getRemoteFile($url)
{
$fg = RemoteFileGetterFactory::getFGInstance();
if ($this->getParam("CSV:remoteauth", false) == true) {
$user = $this->getParam("CSV:remoteuser");
$pass = $this->getParam("CSV:remotepass");
$fg->setCredentials($user, $pass);
}
$cookies = $this->getParam("CSV:remotecookie");
if ($cookies) {
$fg->setCookie($cookies);
}
$this->log("Fetching CSV: {$url}", "startup");
// output filename (current dir+remote filename)
$csvdldir = dirname(__FILE__) . "/downloads";
if (!file_exists($csvdldir)) {
@mkdir($csvdldir);
@chmod($csvdldir, Magmi_Config::getInstance()->getDirMask());
}
$outname = $csvdldir . "/" . basename($url);
$ext = substr(strrchr($outname, '.'), 1);
if ($ext != "txt" && $ext != "csv") {
$outname = $outname . ".csv";
}
// open file for writing
if (file_exists($outname)) {
if ($this->getParam("CSV:forcedl", false) == true) {
unlink($outname);
} else {
return $outname;
}
}
$fg->copyRemoteFile($url, $outname);
// return the csv filename
return $outname;
}
示例14: pluginInit
public final function pluginInit($mmi, $meta, $params = null, $doinit = true, $profile = null)
{
$this->bind($mmi);
$this->_pluginmeta = $meta;
$this->_class = get_class($this);
$this->_config = new Magmi_PluginConfig(get_class($this), $profile);
$this->_config->load();
$this->_magmiconfig = Magmi_Config::getInstance();
$this->_params = $params != null ? array_merge($this->_config->getConfig(), $params) : $this->_config->getConfig();
if (isset($mmi)) {
$this->pluginHello();
}
if ($doinit) {
$this->initialize($this->_params);
}
}
示例15: getClassInstance
{
if (!isset($options["engine"])) {
$options["engine"] = "magmi_productimportengine:Magmi_ProductImportEngine";
}
$enginst = getClassInstance($options["engine"], dirname(dirname(__FILE__)) . "/engines");
return $enginst;
}
// Building option list from command line
$options = buildOptions($argv);
// Getting engine
$importer = getEngineInstance($options);
if (isset($importer)) {
$inifile = isset($options['config']) ? $options['config'] : null;
if (isset($inifile)) {
require_once 'magmi_config.php';
$conf = Magmi_Config::getInstance();
$conf->load($options['config']);
}
// if logger set, use it or use FileLogger by default
$loggerclass = isset($options['logger']) ? $options['logger'] : "FileLogger";
$importer->setLogger(new $loggerclass());
// a chain is a multiple profile run with the following syntax
// [profilename]:[modename],[profilename]:[modename]
// if no workflow chain is defined, create a new one
if (!isset($options["chain"])) {
$options["chain"] = isset($options["profile"]) ? $options["profile"] : "";
$options["chain"] .= isset($options["mode"]) ? ":" . $options["mode"] : "";
}
// parsing the workflow chain
$pdefs = explode(",", $options["chain"]);
// for each import in the workflow