예제 #1
0
 public function __construct($fname = null)
 {
     if ($fname == null) {
         $fname = Magmi_StateManager::getProgressFile(true);
     }
     $this->_fname = $fname;
     $f = fopen($this->_fname, "w");
     if ($f == false) {
         throw new Exception("CANNOT WRITE PROGRESS FILE ");
     }
     fclose($f);
 }
예제 #2
0
 public function afterImport()
 {
     $eng = $this->_callers[0];
     if ($this->getParam("EMAILREP:to", "") != "" && $this->getParam("EMAILREP:from", "") != "") {
         if ($this->getParam("EMAILREP:attachcsv", false) == true) {
             $ds = $eng->getPluginInstanceByClassName("datasources", "Magmi_CSVDataSource");
             if ($ds != null) {
                 $csvfile = $ds->getParam("CSV:filename");
                 $this->addAttachment($csvfile);
             }
         }
         if ($this->getParam("EMAILREP:attachlog", false) == true) {
             // copy magmi report
             $pfile = Magmi_StateManager::getProgressFile(true);
             $this->addAttachment($pfile);
         }
         $ok = $this->send_email($this->getParam("EMAILREP:to"), $this->getParam("EMAILREP:from"), $this->getParam("EMAILREP:from_alias", ""), $this->getParam("EMAILREP:subject", "Magmi import report"), $this->getParam("EMAILREP:body", "report attached"), $this->_attach);
         if (!$ok) {
             $this->log("Cannot send email", "error");
         }
     }
 }
예제 #3
0
<?php

require_once "../inc/magmi_statemanager.php";
require_once "progress_parser.php";
$logfile = $_REQUEST["logfile"];
if (!isset($logfile)) {
    $logfile = Magmi_StateManager::getProgressFile();
}
$logfile = Magmi_StateManager::getStateDir() . DS . $logfile;
if (file_exists($logfile)) {
    $parser = new DefaultProgressParser();
    $parser->setFile($logfile);
    $parser->parse();
    $count = $parser->getData("itime:count");
    if ($count) {
        $lu = $parser->getData("lookup");
        $percent = round((double) $count * 100 / $lu["nlines"], 2);
        $stepd = $parser->getData("step");
        $step = $stepd["value"];
    } else {
        $percent = 0;
    }
    $errors = $parser->getData("error");
    $warnings = $parser->getData("warning");
    //session_start();
    $_SESSION["log_error"] = $errors;
    $_SESSION["log_warning"] = $warnings;
    session_write_close();
} else {
    die("NO FILE");
}
예제 #4
0
$params = $_REQUEST;
require_once "security.php";
ini_set("display_errors", 1);
require_once "../inc/magmi_defs.php";
require_once "../inc/magmi_statemanager.php";
try {
    $engdef = explode(":", $params["engine"]);
    $engine_name = $engdef[0];
    $engine_class = $engdef[1];
    require_once "../engines/{$engine_name}.php";
} catch (Exception $e) {
    die("ERROR");
}
if (Magmi_StateManager::getState() !== "running") {
    Magmi_StateManager::setState("idle");
    $pf = Magmi_StateManager::getProgressFile(true);
    if (file_exists($pf)) {
        @unlink($pf);
    }
    set_time_limit(0);
    $mmi_imp = new $engine_class();
    $logfile = isset($params["logfile"]) ? $params["logfile"] : null;
    if (isset($logfile) && $logfile != "") {
        $fname = Magmi_StateManager::getStateDir() . DIRSEP . $logfile;
        if (file_exists($fname)) {
            @unlink($fname);
        }
        $mmi_imp->setLogger(new FileLogger($fname));
    } else {
        $mmi_imp->setLogger(new EchoLogger());
    }
예제 #5
0
</div>
<form method="POST" id="runmagmi"
	action="magmi.php?ts=<?php 
echo time();
?>
" <?php 
if (!$conf_ok) {
    ?>
	style="display: none" <?php 
}
?>
>
	<input type="hidden" name="run" value="import"></input> <input
		type="hidden" name="logfile"
		value="<?php 
echo Magmi_StateManager::getProgressFile();
?>
"></input>
	<div class="container_12">
		<div class="grid_12 col" id="directrun">
			<h3>Directly run magmi with existing profile</h3>
			<div class="formline">
				<span class="label">Run Magmi With Profile:</span>
				<?php 
$profilelist = $conf->getProfileList();
?>
				<select name="profile" id="runprofile">
					<option <?php 
if (null == $profile) {
    ?>
 selected="selected" <?php