Page MenuHomeIn-Portal Phabricator

D309.id746.diff
No OneTemporary

File Metadata

Created
Mon, Jan 6, 5:10 AM

D309.id746.diff

Index: core/admin_templates/tools/system_tools.tpl
===================================================================
--- core/admin_templates/tools/system_tools.tpl
+++ core/admin_templates/tools/system_tools.tpl
@@ -133,13 +133,21 @@
<input type="button" class="button" onclick="submit_event('adm', 'OnSynchronizeDBRevisions');" value="<inp2:m_Phrase name="la_btn_Synchronize" no_editing="1"/>"/>
</div>
- <div class="group last">
+ <div class="group">
<h4><inp2:m_Phrase name="la_title_SystemToolsDeploy"/></h4>
<div class="hint">
<inp2:m_Phrase name="hint:la_title_SystemToolsDeploy"/>
</div>
<input type="button" class="button" onclick="submit_event('adm', 'OnDeploy');" value="<inp2:m_Phrase name="la_btn_Deploy" no_editing="1"/>"/>
</div>
+
+ <div class="group last">
+ <h4><inp2:m_Phrase name="la_title_SystemToolsDumpAssets"/></h4>
+ <div class="hint">
+ <inp2:m_Phrase name="hint:la_title_SystemToolsDumpAssets"/>
+ </div>
+ <input type="button" class="button" onclick="submit_event('adm', 'OnDumpAssets');" value="<inp2:m_Phrase name="la_btn_Dump" no_editing="1"/>"/>
+ </div>
</div>
</div>
@@ -307,4 +315,4 @@
</inp2:m_if>
</script>
-<inp2:m_include t="incs/footer"/>
\ No newline at end of file
+<inp2:m_include t="incs/footer"/>
Index: core/install/english.lang
===================================================================
--- core/install/english.lang
+++ core/install/english.lang
@@ -34,6 +34,7 @@
<PHRASE Label="la_btn_Deploy" Module="Core" Type="1">RGVwbG95</PHRASE>
<PHRASE Label="la_btn_DesignMode" Module="Core" Type="1">RGVzaWduIE1vZGU=</PHRASE>
<PHRASE Label="la_btn_Down" Module="Core" Type="1">RG93bg==</PHRASE>
+ <PHRASE Label="la_btn_Dump" Module="Core" Type="1">RHVtcA==</PHRASE>
<PHRASE Label="la_btn_Edit" Module="Core" Type="1">RWRpdA==</PHRASE>
<PHRASE Label="la_btn_EditBlock" Module="Core" Type="1">RWRpdCBCbG9jaw==</PHRASE>
<PHRASE Label="la_btn_EditContent" Module="Core" Type="1">RWRpdCBDb250ZW50</PHRASE>
@@ -1542,7 +1543,8 @@
<PHRASE Label="la_title_SystemTools" Module="Core" Type="1">U3lzdGVtIFRvb2xz</PHRASE>
<PHRASE Label="la_title_SystemToolsClearTemplatesCache" Module="Core" Type="1" Hint="PHVsPg0KICA8bGk+RGVsZXRlcyBhbGwgY29tcGlsZWQgdGVtcGxhdGVzIGZyb20gQWRtaW4gQ29uc29sZSBhbmQgRnJvbnQtZW5kIHRoZW1lcy48L2xpPg0KICA8bGk+UmVjb21tZW5kZWQgZm9yIHRoZSBtYWludGVuYW5jZSBwdXJwb3Nlcywgc2luY2UgZG9lcyBub3QgcHJvdmlkZSBhbnkgYWR2YW50YWdlcyBleGNlcHQgZm9yIHRlbXBvcmFyeSBsb3dlcmluZyB1c2FnZSBvZiB0aGUgZGlzayBzcGFjZS4gQWxsIHRlbXBsYXRlcyB3aWxsIGJlIGF1dG9tYXRpY2FsbHkgcmVjb21waWxlZCBhdCB0aGUgdGltZSBvZiB2aXNpdC48L2xpPg0KPC91bD4=">Q2xlYXIgVGVtcGxhdGVzIENhY2hl</PHRASE>
<PHRASE Label="la_title_SystemToolsCommonlyUsedKeys" Module="Core" Type="1">Q29tbW9ubHkgVXNlZCBLZXlz</PHRASE>
- <PHRASE Label="la_title_SystemToolsDeploy" Module="Core" Type="1" Hint="PHVsPg0KPGxpPlRoaXMgZGVwbG95IHNjcmlwdCB3aWxsIGFwcGx5IGFsbCBEYXRhYmFzZSBDaGFuZ2VzIHN0b3JlZCBpbiA8Yj48dT5bbW9kdWxlXS9wcm9qZWN0X3VwZ3JhZGVzLnNxbDwvdT48L2I+IHRvIHRoZSBjdXJyZW50IHdlYnNpdGUgYW5kIHNhdmUgYXBwbGllZCBSZXZpc2lvbnMgaW4gQXBwbGllZERCUmV2aXNpb25zLjwvbGk+DQo8bGk+VGhpcyBkZXBsb3kgc2NyaXB0IHdpbGwgY3JlY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JmFtcCBwcm9kdWN0aW9uKS48L2xpPg0KPGxpPkR1bXBzIHByb2R1Y3Rpb24gYXNzZXRzLjwvbGk+DQo8L3VsPg==">RHVtcCBBc3NldHM=</PHRASE>
<PHRASE Label="la_title_SystemToolsKeyName" Module="Core" Type="1" Hint="PHVsPg0KICA8bGk+TmFtZSBvZiB0aGUgS2V5IHVzZWQgdG8gZ2V0IG9yIHNldCB0aGUgZGF0YSAodmFsdWUpIGluIHRoZSBtZW1vcnkgY2FjaGUgKDxzdHJvbmc+PGk+a0FwcGxpY2F0aW9uOjpzZXRDYWNoZTwvaT48L3N0cm9uZz4gYW5kIDxzdHJvbmc+PGk+a0FwcGxpY2F0aW9uOjpnZXRDYWNoZTwvaT48L3N0cm9uZz4gbWV0aG9kcykuPC9saT4NCjwvdWw+">S2V5IE5hbWU=</PHRASE>
<PHRASE Label="la_title_SystemToolsKeyValue" Module="Core" Type="1" Hint="Q3VycmVudCB2YWx1ZSBvciBhIG5ldyB2YWx1ZSAoZm9yIHNldHRpbmcpIG9mIHRoZSBrZXkgbmFtZSBzcGVjaWZpZWQgYWJvdmUu">S2V5IFZhbHVl</PHRASE>
<PHRASE Label="la_title_SystemToolsLocateUnitConfigFile" Module="Core" Type="1" Hint="PHVsPg0KICA8bGk+U2hvd3MgdGhlIGxvY2F0aW9uIG9mIDxzdHJvbmc+PGk+VW5pdCBDb25maWc8L2k+PC9zdHJvbmc+IGZpbGUsIGFzc29jaWF0ZWQgd2l0aCB0aGUgZ2l2ZW4gPHN0cm9uZz48aT5Vbml0IENvbmZpZyBQcmVmaXg8L2k+PC9zdHJvbmc+IChpZS4gImFkbSIsICJ1IiwgImxhbmciIGFuZCBvdGhlcnMpLjwvbGk+DQo8L3VsPg==">TG9jYXRlIFVuaXQgQ29uZmlnIEZpbGU=</PHRASE>
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql
+++ core/install/upgrades.sql
@@ -2940,3 +2940,7 @@
UPDATE Modules
SET ClassNamespace = 'InPortal\\Core'
WHERE `Name` IN ('Core', 'In-Portal');
+
+UPDATE LanguageLabels
+SET l1_HintTranslation = REPLACE(l1_HintTranslation, '<li>This deploy script will reset all caches at once</li>', '<li>This deploy script will reset all caches at once.</li>\r\n<li>This deploy script will dump production assets.</li>\r\n')
+WHERE PhraseKey = 'LA_TITLE_SYSTEMTOOLSDEPLOY';
Index: core/units/admin/admin_events_handler.php
===================================================================
--- core/units/admin/admin_events_handler.php
+++ core/units/admin/admin_events_handler.php
@@ -50,10 +50,11 @@
{
$perm_value = null;
- $system_events = Array (
+ $system_events = array(
'OnResetModRwCache', 'OnResetSections', 'OnResetConfigsCache', 'OnResetParsedData', 'OnResetMemcache',
'OnDeleteCompiledTemplates', 'OnCompileTemplates', 'OnGenerateTableStructure', 'OnSynchronizeDBRevisions',
- 'OnDeploy', 'OnRebuildThemes', 'OnCheckPrefixConfig', 'OnMemoryCacheGet', 'OnMemoryCacheSet'
+ 'OnDeploy', 'OnRebuildThemes', 'OnDumpAssets', 'OnCheckPrefixConfig', 'OnMemoryCacheGet',
+ 'OnMemoryCacheSet',
);
if ( in_array($event->Name, $system_events) ) {
@@ -499,6 +500,28 @@
}
/**
+ * Dumps assets
+ *
+ * @param kEvent $event Event.
+ *
+ * @return void
+ */
+ protected function OnDumpAssets(kEvent $event)
+ {
+ if ( $this->Application->GetVar('ajax') == 'yes' ) {
+ $event->status = kEvent::erSTOP;
+ }
+
+ /** @var MinifyHelper $minify_helper */
+ $minify_helper = $this->Application->recallObject('MinifyHelper');
+
+ $minify_helper->delete();
+ $minify_helper->dump();
+
+ $event->SetRedirectParam('action_completed', 1);
+ }
+
+ /**
* Saves grid column widths after their resize by user
*
* @param kEvent $event
Index: core/units/helpers/deployment_helper.php
===================================================================
--- core/units/helpers/deployment_helper.php
+++ core/units/helpers/deployment_helper.php
@@ -203,6 +203,7 @@
if ( $ret && !$this->dryRun ) {
$this->resetCaches();
$this->refreshThemes();
+ $this->dumpAssets();
}
if ( !$this->isCommandLine ) {
@@ -349,6 +350,18 @@
}
/**
+ * Dumps assets
+ *
+ * @return void
+ */
+ private function dumpAssets()
+ {
+ $this->out('Dumping Assets ... ');
+ $this->_event->CallSubEvent('OnDumpAssets');
+ $this->displayStatus('OK');
+ }
+
+ /**
* Runs database upgrade script
*
* @return bool
Index: core/units/helpers/minifiers/minify_helper.php
===================================================================
--- core/units/helpers/minifiers/minify_helper.php
+++ core/units/helpers/minifiers/minify_helper.php
@@ -191,6 +191,21 @@
}
/**
+ * Dumps the assets.
+ *
+ * @return void
+ */
+ public function dump()
+ {
+ /** @var kCurlHelper $curl_helper */
+ $curl_helper = $this->Application->recallObject('CurlHelper');
+ $curl_helper->setOptions(array(
+ CURLOPT_COOKIE => 'debug_off=1',
+ ));
+ $curl_helper->Send($this->Application->BaseURL());
+ }
+
+ /**
* Compress $string based on $extension
*
* @param string $string
Index: core/units/helpers/themes_helper.php
===================================================================
--- core/units/helpers/themes_helper.php
+++ core/units/helpers/themes_helper.php
@@ -552,11 +552,6 @@
$this->Application->incrementCacheSerial('theme');
$this->Application->incrementCacheSerial('theme-file');
-
- /** @var MinifyHelper $minify_helper */
- $minify_helper = $this->Application->recallObject('MinifyHelper');
-
- $minify_helper->delete();
}
/**

Event Timeline