User Tools

Site Tools


urapidflow:file_preprocess

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
urapidflow:file_preprocess [2010/10/14 19:28]
unirgy
urapidflow:file_preprocess [2011/07/06 19:11] (current)
unirgy
Line 1: Line 1:
 +<file php urapidflow.php>
 +<?php
  
 +$targetDir = 'var/urapidflow/import/';
 +
 +// initialize Magento environment
 +include_once 'app/Mage.php';
 +Mage::app('admin')->setCurrentStore(0);
 +
 +// download from http location
 +$res = @copy('http://remote.server.com/archive.zip', $targetDir.'archive.zip');
 +if ($res!==true) {
 +    echo "ERROR downloading file";
 +    exit;
 +}
 +
 +// unpack the archive
 +$zip = new ZipArchive();
 +$res = $zip->open($targetDir.'archive.zip');
 +if ($res!==true) {
 +    echo "ERROR unpacking archive";
 +    exit;
 +}
 +$zip->extractTo($targetDir);
 +$zip->close();
 +
 +// run the profile. the profile should be pointing to the file in the archive
 +Mage::helper('urapidflow')->run('Your profile name');
 +</file>
urapidflow/file_preprocess.txt · by unirgy