10

Its seems SUPEE-9767v2 has disabled and removed the option in "Advanced -> Developer -> Template settings", that would allow us to enable/disable symlinks.

What is the other way to enable symlinks after V2 patch install?

1
  • How you install SUPEE-9767 V2, could you share the steps.
    – Gem
    Jul 18, 2017 at 6:57

3 Answers 3

22

You can only do it on DB at the moment.

1. SQL

Either ...

UPDATE core_config_data SET value = '1' WHERE path = 'dev/template/allow_symlink';

Or if entry does not exist ...

INSERT INTO core_config_data (config_id, scope, scope_id, path, value)
VALUES (NULL , 'default', '0', 'dev/template/allow_symlink', '1');

Note: Don't forget to add table prefix if you use one.

2. Script

Or run this from magento root ...

<?php
require_once('./app/Mage.php');
Mage::app();

Mage::getConfig()->saveConfig('dev/template/allow_symlink', '1', 'default', 0);

3. local.xml

Add another XML to app/etc/ directory like local.SUPEE-9767.xml to override local.xml.

<?xml version="1.0"?>
<config>
    <default>
        <dev>
            <template>
                <allow_symlink>1</allow_symlink>
            </template>
        </dev>
    </default>
</config>

4. "Module"

Create a mini "extension" with this system.xml to bring back config option to admin backend:

<?xml version="1.0"?>
<config>
    <sections>
        <dev>
            <groups>
                <template>
                    <show_in_default>1</show_in_default>
                    <fields>
                        <allow_symlink>
                            <show_in_default>1</show_in_default>
                            <backend_model>core/config_data</backend_model>
                        </allow_symlink>
                    </fields>
                </template>
            </groups>
        </dev>
    </sections>
</config>

Add an empty class for backend_model to enable save config value. Thanks to @colinmollenhour, instead of an empty class just reset backend model to parent.

Download: https://github.com/sreichel/magento-StackExchange_AllowSymlink

9

The simplest way is to use n98-magerun which is a very useful command line dev tool for Magento

Toggle symlinks on or off for all store views with

n98-magerun.phar dev:symlinks 0

To check if symlinks are enabled use

n98-magerun.phar config:dump | grep symlink
1

IN patch 9767 v2

Below code Updated in file

app/code/core/Mage/Core/etc/system.xml

--- app/code/core/Mage/Core/etc/system.xml
+++ app/code/core/Mage/Core/etc/system.xml
@@ -601,18 +601,19 @@
                 <label>Template Settings</label>
                 <frontend_type>text</frontend_type>
                 <sort_order>25</sort_order>
-                    <show_in_default>1</show_in_default>
-                    <show_in_website>1</show_in_website>
-                    <show_in_store>1</show_in_store>
+                    <show_in_default>0</show_in_default>
+                    <show_in_website>0</show_in_website>
+                    <show_in_store>0</show_in_store>
                 <fields>
                     <allow_symlink translate="label comment">
                         <label>Allow Symlinks</label>
                         <frontend_type>select</frontend_type>
                         <source_model>adminhtml/system_config_source_yesno</source_model>
+                            <backend_model>adminhtml/system_config_backend_symlink</backend_model>
                         <sort_order>10</sort_order>
-                            <show_in_default>1</show_in_default>
-                            <show_in_website>1</show_in_website>
-                            <show_in_store>1</show_in_store>
+                            <show_in_default>0</show_in_default>
+                            <show_in_website>0</show_in_website>
+                            <show_in_store>0</show_in_store>
                         <comment>Warning! Enabling this feature is not recommended on production environments because it represents a potential security risk.</comment>
                     </allow_symlink>
                 </fields>

Just Update this field <show_in_default>0</show_in_default> to 1

and you will see that setting again

Once you done revert this file

7
  • Isn't this V1? In V2 this lines are back, but <show_in_default> is set to 0. Please correct me if I'm wrong.
    – sv3n
    Jul 18, 2017 at 7:31
  • @sv3n oh My bad I am seeing v1 code, give me 2 min I will update my answer Jul 18, 2017 at 7:33
  • 1
    @sv3n I have updated the answer Jul 18, 2017 at 7:46
  • You shouldn't edit core files. You can easily override this setting in many other ways...
    – 7ochem
    Jan 10, 2018 at 13:44
  • 1
    Worth to mention the added backend_model that prevents saving this field to DB.
    – sv3n
    Jan 16, 2018 at 17:37

Your Answer

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

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