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;
 }
Example #2
0
 public function runUtility()
 {
     $this->connectToMagento();
     $params = $this->getPluginParams($this->_params);
     $this->persistParams($params);
     $rqfile = $params["UTCSQL:queryfile"];
     unset($params["UTCSQL:queryfile"]);
     if (!isabspath($rqfile)) {
         $rqfile = dirname(__FILE__) . "/prequests/{$rqfile}";
     }
     $sql = file_get_contents($rqfile);
     $rparams = array();
     foreach ($params as $pname => $pval) {
         $rpname = substr($pname, strlen("UTCSQL:"));
         $rparams[$rpname] = $pval;
     }
     $this->fillPrefixedParameters($sql, $rparams);
     $results = $this->multipleParamRequests($sql, $rparams, true);
     foreach ($results as $rq => $res) {
         if (count($res) == 0) {
             $this->log("No records found", "info");
         } else {
             for ($i = 0; $i < count($res); $i++) {
                 $str = "";
                 foreach ($res[$i] as $k => $v) {
                     $str .= "{$k}={$v};";
                 }
                 $this->log($str, "info");
             }
         }
     }
     $this->disconnectFromMagento();
 }
<?php

/**
 * Created by PhpStorm.
 * User: seb
 * Date: 26/03/15
 * Time: 18:58
 */
require_once "../../../inc/magmi_defs.php";
require_once "magmi_utils.php";
require_once "../utils.php";
session_start();
$conf = $_REQUEST['magmiconf'];
if ($conf !== '') {
    if (!isabspath($conf)) {
        $conf = MAGMI_BASEDIR . DIRECTORY_SEPARATOR . $conf;
    }
    if (!file_exists($conf)) {
        setMessage("ERROR", "invalid file : {$conf} not found", "magmiconf");
    } else {
        $_SESSION['MAGMI_CONFIG_FILE'] = $conf;
        setMessage("OK", "using magmi configuration file : {$conf} ", "magmiconf");
    }
} else {
    unset($_SESSION['MAGMI_CONFIG_FILE']);
}