Static publisher

Silverstripe Version:
SS4.2.2

Question:

I’m having a lot of trouble getting silverstripe-staticpublishqueue working (I have the beta 1 release installed). I’ve managed to get it to build part of a cache once (either via running dev/tasks directly or via the queued jobs interface in the CMS admin), but can’t get it to do so consistently. All I’m trying to do is get it to run its initial build task to see what’s being built and to take it from there. Any tips would be greatly appreciated!

Can you provide a bit more info?

Is the task failing, or is it not running? Do you get errors in the log?

When I try to run the StaticCacheFullBuildJob with the Jobs Admin in the CMS I get an Internal server error and it logs me out. When I log back in and check the queued job, the message is as follows (it seems like there’s a timeout occurring after 99 pages):

    [2018-11-20 16:58:31][INFO] Building 100 URLS
    [2018-11-20 16:58:31][INFO] array (
    0 => 'http://localhost:8888/?stage=Live',
    1 => 'http://localhost:8888/about/who-we-are/?stage=Live',
... etc.
    98 => 'http://localhost:8888/offline/?stage=Live',
    99 => 'http://localhost:8888/course-information/applicant/entry-into-training-phase/?stage=Live',
    )
    [2018-11-20 16:59:08][INFO] <br />
    <b>Fatal error</b>: Maximum execution time of 30 seconds exceeded in <b>/Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php</b> on line <b>141</b><br />
    ERROR [Alert]: Maximum execution time of 30 seconds exceeded
    IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
    Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
    ======
    132: $width = imagesx($resource);
    133: $height = imagesy($resource);
    134: 
    135: // new canvas
    136: $canvas = imagecreatetruecolor($width, $height);
    137: 
    138: // fill with transparent color
    139: imagealphablending($canvas, false);
    140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
    * 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
    142: imagecolortransparent($canvas, $transparent);
    143: imagealphablending($canvas, true);
    144: 
    145: // copy original
    146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
    147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:08][INFO] ERROR [Alert]: Maximum execution time of 30 seconds exceeded
IN POST /admin/queuedjobs/Symbiote-QueuedJobs-DataObjects-QueuedJobDescriptor/EditForm/field/QueuedJobDescriptor
Line 141 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php

Source
======
132: $width = imagesx($resource);
133: $height = imagesy($resource);
134: 
135: // new canvas
136: $canvas = imagecreatetruecolor($width, $height);
137: 
138: // fill with transparent color
139: imagealphablending($canvas, false);
140: $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127);
* 141: imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent);
142: imagecolortransparent($canvas, $transparent);
143: imagealphablending($canvas, true);
144: 
145: // copy original
146: imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height);
147: imagedestroy($resource);

Trace
=====
SilverStripe\Dev\CliDebugView->renderTrace()
DetailedErrorFormatter.php:119

SilverStripe\Logging\DetailedErrorFormatter->output(1, Maximum execution time of 30 seconds exceeded, /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php, 141, )
DetailedErrorFormatter.php:54

SilverStripe\Logging\DetailedErrorFormatter->format(Array)
AbstractProcessingHandler.php:37

Monolog\Handler\AbstractProcessingHandler->handle(Array)
Logger.php:344

Monolog\Logger->addRecord(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
Logger.php:609

Monolog\Logger->log(550, Fatal Error (E_ERROR): Maximum execution time of 30 seconds exceeded, Array)
ErrorHandler.php:189

Monolog\ErrorHandler->handleFatalError()

[2018-11-20 16:59:09][INFO]

Hello again :wink:

I had the same troubles recently and fixed it by running that tasks from the command line (CLI), as there is by default no maximum execution time limit. Due to a bug (which got fixed recently), you cannot increase the maximum time limit to unlimited when you run the tasks in your browser.

I run this tasks from my silverstripe project root:

Build full cache (adds to queue):

public/vendor/bin/sake dev/tasks/SilverStripe-StaticPublishQueue-Task-StaticCacheFullBuildTask

Process the queue

public/vendor/bin/sake dev/tasks/ProcessJobQueueTask

Depending on your dev machine, project and number of pages, this can take a few minutes. You can monitor the changes in your public/cache folder.

1 Like

@wmk thanks for the tips. Running the tasks via terminal worked, with regards to the timeout. Only problem was any member’s only pages (ie. requiring a member to login) would then show as a redirect link instead. Any ideas how to get around that?

Also, once the cache has been built, I can’t seem to login (eg. via http://localhost:8888/Security/login?BackURL=/members-area/) even though that page shows as missing the cache, it won’t log me in until I delete and clear the cache. The default login page/form is normally on the main Page.ss, maybe this is causing the problem? Any ideas most welcome!

I’m also getting the error
[2018-11-20 21:53:21][INFO] Job caused exception Cookie 'alc_enc' can't be set. The site started outputting content at line 86 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/silverstripe/framework/src/Dev/TaskRunner.php in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/silverstripe/framework/src/Control/CookieJar.php at line 177 [2018-11-20 21:53:21][INFO] ERROR [Emergency]: Uncaught LogicException: Cookie 'alc_enc' can't be set. The site started outputting content at line 86 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/silverstripe/framework/src/Dev/TaskRunner.php IN GET /dev/tasks/ProcessJobQueueTask Line 177 in /Volumes/Elke's Data/Sites/nzmgaSS4/vendor/silverstripe/framework/src/Control/CookieJar.php

BTW: I also had troubles with <% base_tag %> from an old template. When running from CLI in SS4 I found no way to tell it the current port of my dev machine. It defaulted to “http://localhost” instead of “http://localhost:8080”, therefore I deleted the base_tag in the head section.

1 Like

@wmk you’re brilliant! Thanks. Removing <% base_tag %> for my dev machine worked! Until then all my assets were broken!

You need to configure static publisher to exclude some pages from being cached. E.g. form pages etc. This can be done with an extension like below, following the docs

<?php

namespace MyProject\Extension;


use SilverStripe\Core\Extension;

class ExcludeFromStaticPublisher extends Extension
{
    public function urlsToCache()
    {
        return [];
    }
}

Then you can add it to the Page types you need to exclude. In my current project this looked like this in a file called app/config/staticpublisher.yml:

---
name: mysite-staticpublisher
after: staticpublishqueue
---

SilverShop\Page\CartPage:
  extensions:
    - MyProject\Extension\ExcludeFromStaticPublisher

SilverStripe\UserForms\Model\UserDefinedForm:
  extensions:
  - MyProject\Extension\ExcludeFromStaticPublisher

Note the after part in the config header, this makes sure that your extension is added after the static publisher extension. Now add all page types to this config file like shown above. Delete the currently cached files. After a dev/build?flush your excluded page types should not be cached again.

Also a page type, that has too much logic (like setting a cookie) cannot be cached statically.

One side note: even if you cache most of your content statically you should also think about partial caching for a) uncached pages and b) faster generation of static pages.

Yep thanks, that all makes sense. I was already adding
public function urlsToCache()
{
return ;
}
to the relevant page classes. The trouble is if I cache the HomePage (index) I end up not being able to login. I guess I can omit that one (I already have partial caching on it anyway and elsewhere throughout the site). The bigger problem is I have many pages (just the standard Page class) both within the member’s only section and in the public section. If I exclude the entire Page class it’ll carry through to all the subclasses… so I guess I’m looking for a way to just exclude member’s only pages (which are all under the same part of the Site Tree “members-area”)…

You can add your own logic in that extension, e.g. check if $this->owner is publically accessable or a member only page.

Configuring static publisher for the project’s very special needs is always a bunch of work.

1 Like

Ok… so after some experimentation I have made the following extension which excludes all pages requiring a logged in user and have added a setting for individual page control in the CMS.

config file:

---
name: mysite-staticpublisher
after: staticpublishqueue
---

Page:
  extensions:
    - App\Web\StaticPublisherExtension

StaticPublisherExtension.php

<?php

namespace App\Web;

use SilverStripe\Core\Extension;
use SilverStripe\Control\Director;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\FieldGroup;
use SilverStripe\Forms\CheckboxField;

class StaticPublisherExtension extends Extension
{

    private static $db = array(
		'ExcludeFromCache' => 'Boolean'
    );


    public function updateSettingsFields(FieldList $fields) {

        $tabset = $fields->findOrMakeTab('Root.Settings');

        $tabset->push(new Tab(
            'Caching','Caching',
            LiteralField::create('CachingMsg','<p>Only publicly visible pages will be cached.</p>'),
            FieldGroup::create(
                CheckboxField::create('ExcludeFromCache','Exclude from cache?')
            )
        ));
        
    }


    public function urlsToCache()
    {
        // exclude pages containing forms and anything user has chosen to exclude
        $excluded = $this->owner->ExcludeFromCache || in_array(end(explode('\\',$this->owner->ClassName)),['UserDefinedForm','ContactPage']);

        if ($this->owner->canView() && $excluded == false) {
            return [Director::absoluteURL($this->getOwner()->Link()) => 0];
        } else {
            return [];
        }
    }
}

Hopefully this is helpful to someone!

This now generates a pretty accurate list. Only trouble I’m still having is a memory timeout (even when running via Terminal). This seems to happen after the task has actually generated all the pages, so not quite sure what the problem is… yet.

Hmmm… slight caveat to the above:
changing the exclude status of a page doesn’t remove it from the cache (mind you neither does changing whether or not its cached on a class by class basis). Am I missing something here?

I thought staticpublishqueue was meant to purge old/unused cache files? Does this need to be run as a separate task?

I also have the memory timeout problem. Static files are generated but this leaves a Job with a “running” status, preventing further cache build jobs.

Have you been able to fix it ?

UPDATE : nevermind, just raising memory_limit in php.ini fixed it, obviously.

Ok, so the canView() function may not be the most reliable way of checking whether a particular page requires a logged in member. I’m sure there’s a simple solution to this, but I’m not finding it… how do I check for the requirement to be logged in to view a specific page (rather than if the current member can view the page)?

@DrMartinGonzo what memory limit did you set? I haven’t managed to fix this yet.

memory_limit = 256M was enough in my case.

If you’ve set your page to be only visible for logged in users (in settings tab), you could check $this->CanViewType === InheritedPermissions::LOGGED_IN_USERS I think. Not sure, I haven’t really dealt with logged in users in Silverstripe.

Ok, another question… this time to do with the cron job set up on the server. My host wouldn’t run it as php, so I had to use the following instead:

* * * * * sh /path/to/vendor/bin/sake dev/tasks/ProcessJobQueueTask

This at least seems to run the sake script, but I then get the following error (via email):

Status: 302 Found
content-type: text/html; charset=utf-8
location: https://domain.org.nz/Security/login?BackURL=dev%2Ftasks%2FProcessJobQueueTask
vary: X-Forwarded-Protocol
cache-control: no-cache, no-store, must-revalidate

It would seem the script needs to be run as a logged in user. Any ideas here?