forked from San-Dev/dle-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cat-optim.xml
56 lines (55 loc) · 2.02 KB
/
cat-optim.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?xml version="1.0" encoding="utf-8"?>
<dleplugin>
<name>Category-count SQL optimize by Sander</name>
<description>Кеширование счетчика количества новостей для построения постраничной навигации
https://sandev.pro/web/141-optimizaciya-dle.html</description>
<icon></icon>
<version>2.0</version>
<dleversion></dleversion>
<versioncompare>less</versioncompare>
<upgradeurl></upgradeurl>
<filedelete>0</filedelete>
<needplugin></needplugin>
<mnotice>0</mnotice>
<mysqlinstall><![CDATA[]]></mysqlinstall>
<mysqlupgrade><![CDATA[]]></mysqlupgrade>
<mysqlenable><![CDATA[]]></mysqlenable>
<mysqldisable><![CDATA[]]></mysqldisable>
<mysqldelete><![CDATA[]]></mysqldelete>
<phpinstall><![CDATA[]]></phpinstall>
<phpupgrade><![CDATA[]]></phpupgrade>
<phpenable><![CDATA[]]></phpenable>
<phpdisable><![CDATA[]]></phpdisable>
<phpdelete><![CDATA[]]></phpdelete>
<notice><![CDATA[]]></notice>
<file name="engine/modules/functions.php">
<operation action="before">
<searchcode><![CDATA[function dle_cache(]]></searchcode>
<replacecode><![CDATA[function getPostSqlCount($sql_count)
{
global $db;
$cache_hash = md5($sql_count);
$count_all = [
'count' => (int)dle_cache('news_sqlCount', $cache_hash),
];
if (!$count_all['count']) {
$count_all = $db->super_query( $sql_count );
create_cache('news_sqlCount', (int)$count_all['count'], $cache_hash);
}
return $count_all;
}]]></replacecode>
</operation>
</file>
<file name="engine/modules/show.short.php">
<operation action="replace">
<searchcode><![CDATA[$count_all = $db->super_query( $sql_count );]]></searchcode>
<replacecode><![CDATA[$count_all = getPostSqlCount( $sql_count );]]></replacecode>
</operation>
</file>
<file name="engine/modules/show.custom.php">
<operation action="replace">
<searchcode><![CDATA[$count_all = $db->super_query( $sql_count );]]></searchcode>
<replacecode><![CDATA[$count_all = getPostSqlCount( $sql_count );]]></replacecode>
</operation>
</file>
</dleplugin>