How to enable symlinks after SUPEE-9767 V2 install?
-
10-10-2020 - |
Question
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?
Solution
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 Thanks to @colinmollenhour, instead of an empty class just reset backend model to parent.backend_model
to enable save config value.
Download: https://github.com/sreichel/magento-StackExchange_AllowSymlink
OTHER TIPS
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
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