<commit_before><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Vehicles\Controller;

use Application\Controller\AbstractController;

class ImportController extends AbstractController
{
    function indexAction()
    {
        $schema = new \VF_Schema;

        if($this->getRequest()->isPost()) {

            if($this->attemptedFileUpload() && $this->fileUploadHasError()) {
                $this->flashFileUploadErrorMessage();
            } else {

                if($_FILES['file']['tmp_name']) {
                    $tmpFile = $_FILES['file']['tmp_name'];
                } else {
                    $tmpFile = sys_get_temp_dir() . '/' . sha1(uniqid());
                    file_put_contents($tmpFile, $_POST['text']);
                }

                $importer = new \VF_Import_VehiclesList_CSV_Import($tmpFile);
                $importer
                    ->setProductTable('ps_product')
                    ->setProductSkuField('reference')
                    ->setProductIdField('id_product');

                //$importer->setLog($log);
                $importer->import();

                $this->flashMessenger()
                    ->setNamespace('success')
                    ->addMessage('Imported Fitments');
            }
        }

        return array(
            'schema' => $schema->getLevels()<commit_msg>Removed unneded table name setting from VehiclesList import, corrected success message<commit_after><?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Vehicles\Controller;

use Application\Controller\AbstractController;

class ImportController extends AbstractController
{
    function indexAction()
    {
        $schema = new \VF_Schema;

        if($this->getRequest()->isPost()) {

            if($this->attemptedFileUpload() && $this->fileUploadHasError()) {
                $this->flashFileUploadErrorMessage();
            } else {

                if($_FILES['file']['tmp_name']) {
                    $tmpFile = $_FILES['file']['tmp_name'];
                } else {
                    $tmpFile = sys_get_temp_dir() . '/' . sha1(uniqid());
                    file_put_contents($tmpFile, $_POST['text']);
                }

                $importer = new \VF_Import_VehiclesList_CSV_Import($tmpFile);

                //$importer->setLog($log);
                $importer->import();

                $this->flashMessenger()
                    ->setNamespace('success')
                    ->addMessage('Imported Vehicles List');
            }
        }

        return array(
            'schema' => $schema->getLevels()
{'fraction_non_alphanumeric': 0.13504925325707023, 'fraction_numerical': 0.005719733079122974, 'mean_word_length': 2.0009532888465205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1562526', 'n_tokens_mistral': 890, 'n_tokens_neox': 808, 'n_words': 144}