Plugin Directory

Changeset 3486670


Ignore:
Timestamp:
03/19/2026 04:23:40 PM (2 weeks ago)
Author:
seraphinitesoft
Message:

seraphinite-accelerator: 2.28.17.

Location:
seraphinite-accelerator
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • seraphinite-accelerator/tags/2.28.17/content.php

    r3486643 r3486670  
    101101}
    102102
     103function ContentProcess_InitLocalCbs( &$ctxProcess )
     104{
     105    $cbs = new AnyObj();
     106    $cbs -> ctxProcess = &$ctxProcess;
     107
     108    $cbs -> ReportStage =
     109        function( $cbs, $stage = null, $stageDsc = null )
     110        {
     111            $dataUpd = array( 'stageDsc' => $stageDsc );
     112            if( $stage )
     113                $dataUpd[ 'stage' ] = $stage;
     114
     115            global $seraph_accel_g_prepPrms;
     116            return( $seraph_accel_g_prepPrms ? ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), $dataUpd ) : true );
     117        };
     118
     119    $cbs -> IsAborted =
     120        function( $cbs, $ctxProcess = null, $settCache = null )
     121        {
     122            return( ContentProcess_IsAborted( $ctxProcess, $settCache ) );
     123        };
     124
     125    $cbs -> GetContentProcessorForce =
     126        function( $cbs, $sett )
     127        {
     128            return( GetContentProcessorForce( $sett ) );
     129        };
     130
     131    $cbs -> ContPostProc =
     132        function( $cbs, $type, $content, $isFile = true )
     133        {
     134            if( $type == 'css' )
     135                $content = apply_filters( 'seraph_accel_css_content', $content, $isFile );
     136            else if( $type == 'js' )
     137                $content = apply_filters( 'seraph_accel_js_content', $content, $isFile );
     138            return( $content );
     139        };
     140
     141    $cbs -> PreFetchLocalFiles =
     142        function( $cbs, $a, $cont = true )
     143        {
     144            return( array_keys( ContentProcess_PreFetchLocalFiles_Expand( $cbs -> ctxProcess, $a ) ) );
     145        };
     146
     147    $cbs -> LocalFileExists =
     148        function( $cbs, $filePath, $filePathRoot = null )
     149        {
     150            return( @file_exists( $filePath ) );
     151        };
     152
     153    $cbs -> ReadLocalFile =
     154        function( $cbs, $filePath, $filePathRoot = null )
     155        {
     156            if( !$filePath )
     157                return( null );
     158
     159            $cont = Gen::FileGetContents( $filePath );
     160            if( $cont === false && $filePathRoot && !Gen::DoesFileDirExist( $filePath, $filePathRoot ) )
     161                $cont = null;
     162            return( $cont );
     163        };
     164
     165    $cbs -> WriteLocalFile =
     166        function( $cbs, $filePath, $data, $fileTime = null, $delIfFail = false )
     167        {
     168            $lock = new Lock( 'il', $cbs -> ctxProcess[ 'siteCacheRootDir' ] );
     169            return( Gen::FileWriteTmpAndReplace( $lock, $filePath, $data, $fileTime, $delIfFail ) );
     170        };
     171
     172    $cbs -> GetLocalFileSize =
     173        function( $cbs, $filePath )
     174        {
     175            return( Gen::FileSize( $filePath ) );
     176        };
     177
     178    $cbs -> GetLocalFileMTime =
     179        function( $cbs, $filePath )
     180        {
     181            return( Gen::FileMTime( $filePath ) );
     182        };
     183
     184    $cbs -> DeleteLocalFile =
     185        function( $cbs, $filePath )
     186        {
     187            return( Gen::Unlink( $filePath ) );
     188        };
     189
     190    $cbs -> asuxsadkxsshi =
     191        function( $cbs, $dataPath, $type, $oiCfn )
     192        {
     193            return( CacheCcEx( $dataPath, $type, $oiCfn ) );
     194        };
     195
     196    $cbs -> ScRd =
     197        function( $cbs, $dataPath, $settCache, $type, $oiCi, $oiCfn )
     198        {
     199            return( CacheCrEx( $dataPath, $settCache, $type, $oiCi, $oiCfn ) );
     200        };
     201
     202    $cbs -> ScWr =
     203        function( $cbs, $settCache, $dataPath, $composite, $content, $type, $oiCfn )
     204        {
     205            return( CacheCwEx( $settCache, $dataPath, $composite, $content, $type, $oiCfn ) );
     206        };
     207
     208    $cbs -> Tof_GetFileDataEx =
     209        function( $cbs, $dir, $id )
     210        {
     211            return( Tof_GetFileDataEx( $dir, $id ) );
     212        };
     213
     214    $cbs -> Tof_SetFileDataEx =
     215        function( $cbs, $dir, $id, $data, $overwrite = true )
     216        {
     217            return( Tof_SetFileDataEx( $dir, $id, $data, $overwrite ) );
     218        };
     219
     220    $cbs -> Learn_ReadDsc =
     221        function( $cbs, $lrnFile )
     222        {
     223            return( Learn_ReadDsc( $lrnFile ) );
     224        };
     225
     226    $cbs -> Learn_Clear =
     227        function( $cbs, $lrnFile, $bMain = true, $bPending = true )
     228        {
     229            Learn_Clear( $lrnFile, $bMain, $bPending );
     230        };
     231
     232    $cbs -> Learn_IsStarted =
     233        function( $cbs, $ctxProcess )
     234        {
     235            return( Learn_IsStarted( $ctxProcess ) );
     236        };
     237
     238    $cbs -> Learn_Start =
     239        function( $cbs, $ctxProcess )
     240        {
     241            return( Learn_Start( $ctxProcess ) );
     242        };
     243
     244    $cbs -> Learn_Finish =
     245        function( $cbs, $ctxProcess )
     246        {
     247            return( Learn_Finish( $ctxProcess ) );
     248        };
     249
     250    $cbs -> ExtContents_CacheGet =
     251        function( $cbs, $extCacheId )
     252        {
     253            return( ExtContents_Local_CacheGet( Gen::GetFileDir( $cbs -> ctxProcess[ 'dataPath' ] ), $extCacheId ) );
     254        };
     255
     256    $cbs -> ExtContents_CacheSet =
     257        function( $cbs, $extCacheId, $fileType, $contCacheTtl, $contId, $contCache )
     258        {
     259            ExtContents_Local_CacheSet( Gen::GetFileDir( $cbs -> ctxProcess[ 'dataPath' ] ), $extCacheId, $fileType, $contCacheTtl, $contId, $contCache );
     260        };
     261
     262    $cbs -> CustomMethod =
     263        function( $cbs, $name, $args )
     264        {
     265            return( ContentProcess_CallCustomMethod( $name, $args ) );
     266        };
     267
     268    $cbs -> ImagesProcessSrcSizeAlternatives_CacheGet =
     269        function( $cbs, $imgStgId )
     270        {
     271            return( Images_ProcessSrcSizeAlternatives_Cache_Get( $cbs -> ctxProcess[ 'dataPath' ], $imgStgId ) );
     272        };
     273
     274    $cbs -> ImagesProcessSrcSizeAlternatives_CacheSet =
     275        function( $cbs, $imgStgId, $v )
     276        {
     277            return( Images_ProcessSrcSizeAlternatives_Cache_Set( $cbs -> ctxProcess[ 'dataPath' ], $imgStgId, $v ) );
     278        };
     279
     280    $cbs -> PostPrepareObj =
     281        function( $cbs, $type, $addr, $priority, $data = array(), $priorityInitiator = null, $time = null )
     282        {
     283            return( CachePostPrepareObjEx( $type, $addr, $cbs -> ctxProcess[ 'siteId' ], $priority, $data, $priorityInitiator, $time ) );
     284        };
     285
     286    $ctxProcess[ 'cbs' ] = $cbs;
     287}
     288
    103289function _JsClk_XpathExtFunc_ifExistsThenCssSel( $v, $cssSel )
    104290{
  • seraphinite-accelerator/tags/2.28.17/readme.txt

    r3486643 r3486670  
    172172Fixes:
    173173
     174* Base version cant be activated.
    174175* PHP error on some sites: Call to undefined function getrusage().
    175176* Simple thread of optimization doesnt work with custom 'index.php'.
  • seraphinite-accelerator/trunk/content.php

    r3485735 r3486670  
    101101}
    102102
     103function ContentProcess_InitLocalCbs( &$ctxProcess )
     104{
     105    $cbs = new AnyObj();
     106    $cbs -> ctxProcess = &$ctxProcess;
     107
     108    $cbs -> ReportStage =
     109        function( $cbs, $stage = null, $stageDsc = null )
     110        {
     111            $dataUpd = array( 'stageDsc' => $stageDsc );
     112            if( $stage )
     113                $dataUpd[ 'stage' ] = $stage;
     114
     115            global $seraph_accel_g_prepPrms;
     116            return( $seraph_accel_g_prepPrms ? ProcessCtlData_Update( ($seraph_accel_g_prepPrms[ 'pc' ]??null), $dataUpd ) : true );
     117        };
     118
     119    $cbs -> IsAborted =
     120        function( $cbs, $ctxProcess = null, $settCache = null )
     121        {
     122            return( ContentProcess_IsAborted( $ctxProcess, $settCache ) );
     123        };
     124
     125    $cbs -> GetContentProcessorForce =
     126        function( $cbs, $sett )
     127        {
     128            return( GetContentProcessorForce( $sett ) );
     129        };
     130
     131    $cbs -> ContPostProc =
     132        function( $cbs, $type, $content, $isFile = true )
     133        {
     134            if( $type == 'css' )
     135                $content = apply_filters( 'seraph_accel_css_content', $content, $isFile );
     136            else if( $type == 'js' )
     137                $content = apply_filters( 'seraph_accel_js_content', $content, $isFile );
     138            return( $content );
     139        };
     140
     141    $cbs -> PreFetchLocalFiles =
     142        function( $cbs, $a, $cont = true )
     143        {
     144            return( array_keys( ContentProcess_PreFetchLocalFiles_Expand( $cbs -> ctxProcess, $a ) ) );
     145        };
     146
     147    $cbs -> LocalFileExists =
     148        function( $cbs, $filePath, $filePathRoot = null )
     149        {
     150            return( @file_exists( $filePath ) );
     151        };
     152
     153    $cbs -> ReadLocalFile =
     154        function( $cbs, $filePath, $filePathRoot = null )
     155        {
     156            if( !$filePath )
     157                return( null );
     158
     159            $cont = Gen::FileGetContents( $filePath );
     160            if( $cont === false && $filePathRoot && !Gen::DoesFileDirExist( $filePath, $filePathRoot ) )
     161                $cont = null;
     162            return( $cont );
     163        };
     164
     165    $cbs -> WriteLocalFile =
     166        function( $cbs, $filePath, $data, $fileTime = null, $delIfFail = false )
     167        {
     168            $lock = new Lock( 'il', $cbs -> ctxProcess[ 'siteCacheRootDir' ] );
     169            return( Gen::FileWriteTmpAndReplace( $lock, $filePath, $data, $fileTime, $delIfFail ) );
     170        };
     171
     172    $cbs -> GetLocalFileSize =
     173        function( $cbs, $filePath )
     174        {
     175            return( Gen::FileSize( $filePath ) );
     176        };
     177
     178    $cbs -> GetLocalFileMTime =
     179        function( $cbs, $filePath )
     180        {
     181            return( Gen::FileMTime( $filePath ) );
     182        };
     183
     184    $cbs -> DeleteLocalFile =
     185        function( $cbs, $filePath )
     186        {
     187            return( Gen::Unlink( $filePath ) );
     188        };
     189
     190    $cbs -> asuxsadkxsshi =
     191        function( $cbs, $dataPath, $type, $oiCfn )
     192        {
     193            return( CacheCcEx( $dataPath, $type, $oiCfn ) );
     194        };
     195
     196    $cbs -> ScRd =
     197        function( $cbs, $dataPath, $settCache, $type, $oiCi, $oiCfn )
     198        {
     199            return( CacheCrEx( $dataPath, $settCache, $type, $oiCi, $oiCfn ) );
     200        };
     201
     202    $cbs -> ScWr =
     203        function( $cbs, $settCache, $dataPath, $composite, $content, $type, $oiCfn )
     204        {
     205            return( CacheCwEx( $settCache, $dataPath, $composite, $content, $type, $oiCfn ) );
     206        };
     207
     208    $cbs -> Tof_GetFileDataEx =
     209        function( $cbs, $dir, $id )
     210        {
     211            return( Tof_GetFileDataEx( $dir, $id ) );
     212        };
     213
     214    $cbs -> Tof_SetFileDataEx =
     215        function( $cbs, $dir, $id, $data, $overwrite = true )
     216        {
     217            return( Tof_SetFileDataEx( $dir, $id, $data, $overwrite ) );
     218        };
     219
     220    $cbs -> Learn_ReadDsc =
     221        function( $cbs, $lrnFile )
     222        {
     223            return( Learn_ReadDsc( $lrnFile ) );
     224        };
     225
     226    $cbs -> Learn_Clear =
     227        function( $cbs, $lrnFile, $bMain = true, $bPending = true )
     228        {
     229            Learn_Clear( $lrnFile, $bMain, $bPending );
     230        };
     231
     232    $cbs -> Learn_IsStarted =
     233        function( $cbs, $ctxProcess )
     234        {
     235            return( Learn_IsStarted( $ctxProcess ) );
     236        };
     237
     238    $cbs -> Learn_Start =
     239        function( $cbs, $ctxProcess )
     240        {
     241            return( Learn_Start( $ctxProcess ) );
     242        };
     243
     244    $cbs -> Learn_Finish =
     245        function( $cbs, $ctxProcess )
     246        {
     247            return( Learn_Finish( $ctxProcess ) );
     248        };
     249
     250    $cbs -> ExtContents_CacheGet =
     251        function( $cbs, $extCacheId )
     252        {
     253            return( ExtContents_Local_CacheGet( Gen::GetFileDir( $cbs -> ctxProcess[ 'dataPath' ] ), $extCacheId ) );
     254        };
     255
     256    $cbs -> ExtContents_CacheSet =
     257        function( $cbs, $extCacheId, $fileType, $contCacheTtl, $contId, $contCache )
     258        {
     259            ExtContents_Local_CacheSet( Gen::GetFileDir( $cbs -> ctxProcess[ 'dataPath' ] ), $extCacheId, $fileType, $contCacheTtl, $contId, $contCache );
     260        };
     261
     262    $cbs -> CustomMethod =
     263        function( $cbs, $name, $args )
     264        {
     265            return( ContentProcess_CallCustomMethod( $name, $args ) );
     266        };
     267
     268    $cbs -> ImagesProcessSrcSizeAlternatives_CacheGet =
     269        function( $cbs, $imgStgId )
     270        {
     271            return( Images_ProcessSrcSizeAlternatives_Cache_Get( $cbs -> ctxProcess[ 'dataPath' ], $imgStgId ) );
     272        };
     273
     274    $cbs -> ImagesProcessSrcSizeAlternatives_CacheSet =
     275        function( $cbs, $imgStgId, $v )
     276        {
     277            return( Images_ProcessSrcSizeAlternatives_Cache_Set( $cbs -> ctxProcess[ 'dataPath' ], $imgStgId, $v ) );
     278        };
     279
     280    $cbs -> PostPrepareObj =
     281        function( $cbs, $type, $addr, $priority, $data = array(), $priorityInitiator = null, $time = null )
     282        {
     283            return( CachePostPrepareObjEx( $type, $addr, $cbs -> ctxProcess[ 'siteId' ], $priority, $data, $priorityInitiator, $time ) );
     284        };
     285
     286    $ctxProcess[ 'cbs' ] = $cbs;
     287}
     288
    103289function _JsClk_XpathExtFunc_ifExistsThenCssSel( $v, $cssSel )
    104290{
  • seraphinite-accelerator/trunk/readme.txt

    r3486643 r3486670  
    172172Fixes:
    173173
     174* Base version cant be activated.
    174175* PHP error on some sites: Call to undefined function getrusage().
    175176* Simple thread of optimization doesnt work with custom 'index.php'.
Note: See TracChangeset for help on using the changeset viewer.