2

I'm attempting to create a staging environment using Magento "Staging Website" feature that was include in 1.12 (System > Content Staging). However, after the initial set up is complete, all I'm left with is a new store view and a few empty files

staging/base_staging/.htaccess
staging/base_staging/index.php

I don't see anything in var/log and have reindexed. My guess is that if these files are empty, it's obviously not going to do anything.

What could have prevented this from running correctly?

2
  • Have you checked your permissions of the staging folder? Also, when you go to the URL, does anything happen (authentication requests, etc.)? May 31, 2013 at 2:07
  • 777 and owned by apache. It loads fine, it's just a blank index.php so there's nothing there. May 31, 2013 at 17:35

1 Answer 1

1

From Enterprise_Staging_Model_Entry

    /**
     * Create entry point if possible
     *
     * @return Enterprise_Staging_Model_Entry
     */
    public function save()
    {
        $this->_ensureWebsite();
        if ($this->canEntryPointBeCreated()) {
            $sample = file_get_contents(BP . DS . 'index.php.sample');
            $outputFile = $this->getFilename();
            if (!is_dir(dirname($outputFile))) {
                mkdir(dirname($outputFile));
            }
            $result = str_replace(
                array('include $', 'app/Mage.php'),
                array('include \'../../\' . $', '../../app/Mage.php'),
                $sample
            );
            $result = preg_replace('/Mage::run\(.*?\)/us', "Mage::run('{$this->_website->getCode()}', 'website')", $result);
            file_put_contents($outputFile, $result);

            $sample = file_get_contents(BP . DS . '.htaccess.sample');

$search = <<<SEARCH
############################################
## workaround for HTTP authorization
## in CGI environment
SEARCH;

$replace = <<<REPLACE
############################################
## add 'no_cache' GET parameter for staging sites

    RewriteCond %{QUERY_STRING} !(^|[?&])no_cache([&=]|$)
    RewriteRule (.*) $1?no_cache [QSA]

############################################
## workaround for HTTP authorization
## in CGI environment
REPLACE;

            $sample = str_replace($search, $replace, $sample);
            $outputFile = $this->getBaseFolder() . DS . $this->_website->getCode() . DS . '.htaccess';
            file_put_contents($outputFile, $sample);
        }
        return $this;
    }

Make sure index.php.sample and .htaccess.sample exist. They are copied when creating a new staging environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.