Skip to content

Commit

Permalink
[BUGFIX] Migrate to new extension key
Browse files Browse the repository at this point in the history
  • Loading branch information
lochmueller committed Sep 6, 2016
1 parent 91f01d2 commit 69e6844
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Classes/Cache/Rule/PageCacheable.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PageCacheable extends AbstractRule
*/
public function checkRule($frontendController, $uri, &$explanation, &$skipProcessing)
{
if (!$frontendController->page['tx_ncstaticfilecache_cache']) {
if (!$frontendController->page['tx_staticfilecache_cache']) {
$explanation[__CLASS__] = 'static cache disabled on page';
}
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Cache/StaticFileBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class StaticFileBackend extends AbstractBackend
*
* @var string
*/
protected $cacheDirectory = 'typo3temp/tx_ncstaticfilecache/';
protected $cacheDirectory = 'typo3temp/tx_staticfilecache/';

/**
* Saves data in the cache.
Expand Down
4 changes: 2 additions & 2 deletions Classes/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function __construct()
$this->configuration = array_merge($this->configuration, $extensionConfig);
}
}
if (isset($GLOBALS['TSFE']->tmpl->setup['tx_ncstaticfilecache.']) && is_array($GLOBALS['TSFE']->tmpl->setup['tx_ncstaticfilecache.'])) {
if (isset($GLOBALS['TSFE']->tmpl->setup['tx_staticfilecache.']) && is_array($GLOBALS['TSFE']->tmpl->setup['tx_staticfilecache.'])) {
$this->configuration = array_merge($this->configuration,
$GLOBALS['TSFE']->tmpl->setup['tx_ncstaticfilecache.']);
$GLOBALS['TSFE']->tmpl->setup['tx_staticfilecache.']);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Classes/Hook/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Crawler
*/
public function clearStaticFile(array $parameters, TypoScriptFrontendController $pObj)
{
if (ExtensionManagementUtility::isLoaded('crawler') && $pObj->applicationData['tx_crawler']['running'] && in_array('tx_ncstaticfilecache_clearstaticfile',
if (ExtensionManagementUtility::isLoaded('crawler') && $pObj->applicationData['tx_crawler']['running'] && in_array('tx_staticfilecache_clearstaticfile',
$pObj->applicationData['tx_crawler']['parameters']['procInstructions'])
) {
$pageId = $GLOBALS['TSFE']->id;
Expand Down
3 changes: 3 additions & 0 deletions Documentation/ChangeLog/Index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
ChangeLog
---------

For newer log entries, take a look at:
https://github.com/lochmueller/staticfilecache/commits/master

2015-12-28 Tim Lochmüller <[email protected]>

- [BUGFIX] Fix the "Illegal link configuration." check
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Configuration/Global.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This allows you to format the time according to your own locale. Please see the

Recreate URI by typoLink to have a valid cached file name.

*TS: tx_ncstaticfilecache.disableCache*
*TS: tx_staticfilecache.disableCache*

By setting this to a true value, the current page and page branch will not be cached statically.

8 changes: 4 additions & 4 deletions Documentation/Configuration/Htaccess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ This is the base .htaccess configuration. Please take a look for the default var
# Check if the requested file exists in the cache, otherwise default to index.html that
# set in an environment variable that is used later on
RewriteCond %{ENV:SFC_ROOT}/typo3temp/tx_ncstaticfilecache/%{ENV:SFC_PROTOCOL}/%{HTTP_HOST}%{ENV:SFC_URI} !-f
RewriteCond %{ENV:SFC_ROOT}/typo3temp/tx_staticfilecache/%{ENV:SFC_PROTOCOL}/%{HTTP_HOST}%{ENV:SFC_URI} !-f
RewriteRule .* - [E=SFC_FILE:/index.html]
### Begin: Static File Cache (main) ####
Expand All @@ -41,7 +41,7 @@ This is the base .htaccess configuration. Please take a look for the default var
RewriteCond %{QUERY_STRING} ^$
# It only makes sense to do the other checks if a static file actually exists.
RewriteCond %{ENV:SFC_ROOT}/typo3temp/tx_ncstaticfilecache/%{ENV:SFC_PROTOCOL}/%{HTTP_HOST}%{ENV:SFC_URI}%{ENV:SFC_FILE}%{ENV:SFC_GZIP} -f
RewriteCond %{ENV:SFC_ROOT}/typo3temp/tx_staticfilecache/%{ENV:SFC_PROTOCOL}/%{HTTP_HOST}%{ENV:SFC_URI}%{ENV:SFC_FILE}%{ENV:SFC_GZIP} -f
# NO frontend user is logged in. Logged in frontend users may see different
# information than anonymous users. But the anonymous version is cached. So
Expand All @@ -60,10 +60,10 @@ This is the base .htaccess configuration. Please take a look for the default var
RewriteCond %{HTTP_COOKIE} !be_typo_user [NC]
# Rewrite the request to the static file.
RewriteRule .* typo3temp/tx_ncstaticfilecache/%{ENV:SFC_PROTOCOL}/%{HTTP_HOST}%{ENV:SFC_URI}%{ENV:SFC_FILE}%{ENV:SFC_GZIP} [L]
RewriteRule .* typo3temp/tx_staticfilecache/%{ENV:SFC_PROTOCOL}/%{HTTP_HOST}%{ENV:SFC_URI}%{ENV:SFC_FILE}%{ENV:SFC_GZIP} [L]
# Do not allow direct call the cache entries
RewriteCond %{ENV:SFC_URI} ^/typo3temp/tx_ncstaticfilecache/.*
RewriteCond %{ENV:SFC_URI} ^/typo3temp/tx_staticfilecache/.*
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule .* - [F,L]
Expand Down
8 changes: 4 additions & 4 deletions Documentation/Configuration/Nginx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This configuration example adds a named location_ called @sfc which replaces the
The @sfc location_ includes all checks necessary to decide whether the current request can be handled with
a static file or needs to be directed to TYPO3.
If all checks pass, the try_files_ directive is used to find the files in
typo3temp/tx_ncstaticfilecache/ and if unavailable, redirect to index.php.
typo3temp/tx_staticfilecache/ and if unavailable, redirect to index.php.

In your nginx configuration you need to replace your '/' location, which probably looks like the following:

Expand Down Expand Up @@ -63,12 +63,12 @@ By the following configuration:
}
charset utf8;
try_files /typo3temp/tx_ncstaticfilecache/${scheme}/${host}${uri}/index.html
/typo3temp/tx_ncstaticfilecache/${scheme}/${host}${uri}
try_files /typo3temp/tx_staticfilecache/${scheme}/${host}${uri}/index.html
/typo3temp/tx_staticfilecache/${scheme}/${host}${uri}
=405;
}
location /typo3temp/tx_ncstaticfilecache {
location /typo3temp/tx_staticfilecache {
deny all;
}
Expand Down
6 changes: 3 additions & 3 deletions Documentation/Faq/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ Check if a file exists (-f) for this request uri

.. code-block:: bash
RewriteCond %{DOCUMENT_ROOT}/typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}/%{REQUEST_URI}index.html -f
RewriteCond %{DOCUMENT_ROOT}/typo3temp/tx_staticfilecache/%{HTTP_HOST}/%{REQUEST_URI}index.html -f
If so, rewrite all uri's that meet these conditions to the static file. This is the last rule ( [L] )

.. code-block:: bash
RewriteRule .* typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}/%{REQUEST_URI} [L]
RewriteRule .* typo3temp/tx_staticfilecache/%{HTTP_HOST}/%{REQUEST_URI} [L]
If none of the conditions are met, mod_rewrite will fall through to the next ruleset.

*Q: Ok, so I logged out of the backend, but I still don't get to see the statically cached pages, what's up?*
A: Hum . . . although you have logged out of the backend, your be_typo_user is still in the browser. The cookie is set by default to expire at the end of the browser session. You need to either restart your browser or go to your browsers cookie management tool and drop the cookie manually.
A: Hum . . . although you have logged out of the backend, your be_typo_user is still in the browser. The cookie is set by default to expire at the end of the browser session. You need to either restart your browser or go to your browsers cookie management tool and drop the cookie manually.
2 changes: 1 addition & 1 deletion Documentation/StaticDynamic/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Note that you will have to fill in your own values for the php executable and th

Nuskool

A backend user by the name of '_cli_ncstaticfilecache' needs to exist. Create this user before scheduling the task.
A backend user by the name of '_cli_staticfilecache' needs to exist. Create this user before scheduling the task.

.. code-block:: bash
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# staticfilecache
# EXT:staticfilecache
Static File Cache for TYPO3


2 changes: 1 addition & 1 deletion Resources/Private/Language/locallang.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<languageKey index="default" type="array">
<label index="module.title">Static File Cache</label>
<label index="staticfilecache.field">Cache page as static file</label>
<label index="moduleFunction.tx_ncstaticfilecache_infomodule">Static file cache</label>
<label index="moduleFunction.tx_staticfilecache_infomodule">Static file cache</label>
<label index="staticfilecache_task_removeExpiredPages.name">Remove expired pages</label>
<label index="staticfilecache_task_removeExpiredPages.description">All expired pages will be removed from the cache.</label>
</languageKey>
Expand Down
2 changes: 1 addition & 1 deletion ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

// Register with "crawler" extension:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['procInstructions']['tx_ncstaticfilecache_clearstaticfile'] = 'clear static cache file';
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['crawler']['procInstructions']['tx_staticfilecache_clearstaticfile'] = 'clear static cache file';

// Hook to process clearing static cached files if "crawler" extension is active:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['headerNoCache'][$_EXTKEY] = \SFC\Staticfilecache\Hook\Crawler::class . '->clearStaticFile';
Expand Down
4 changes: 2 additions & 2 deletions ext_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

$tmp = [
'tx_ncstaticfilecache_cache' => [
'tx_staticfilecache_cache' => [
'exclude' => 0,
'label' => 'LLL:EXT:staticfilecache/Resources/Private/Language/locallang.xml:staticfilecache.field',
'config' => [
Expand All @@ -20,7 +20,7 @@
];

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('pages', $tmp);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages', 'tx_ncstaticfilecache_cache;;;;1-1-1');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages', 'tx_staticfilecache_cache;;;;1-1-1');

if (TYPO3_MODE == 'BE') {
// Add Web>Info module:
Expand Down
4 changes: 2 additions & 2 deletions ext_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# Table structure for table 'pages'
#
CREATE TABLE pages (
tx_ncstaticfilecache_cache tinyint(1) DEFAULT '1',
);
tx_staticfilecache_cache tinyint(1) DEFAULT '1',
);

0 comments on commit 69e6844

Please sign in to comment.