Forum

Thread tagged as: Question, Configuration, Addons

Kraken table setup and how to test if image optimizations occurred

Hi,

Should the base table for "perch2_kraken_jobs" be created automatically awhen I install and use the perch_kraken app? I understand that API optimizations do not appear on the kraken.io optimization history page so unsure how to check if optimization has occurred.

I ran some upload tests and got a debug message that the said

Invalid query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_scottgruber.perch2_kraken_jobs' doesn't exist and image file size are the same as when uploaded. 

I'm storing images on Amazon S3 and images are being uploaded and referenced on the site correctly. I double-checked the Kraken API credentials and they are set correctly.

Here is my Diagnostic Report

Perch Runway: 2.8.8, PHP: 5.5.9-1ubuntu4.7, MySQL: 5.5.41, with PDO
Server OS: Linux, apache2handler
Installed apps: content (2.8.8), assets (2.8.8), categories (2.8.8), collection_2 (2.8.8), perch_kraken (1.0)
App runtimes: <?php $apps_list = array( 'content', 'categories', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /var/www/html/perch
PERCH_CORE: /var/www/html/perch/core
PERCH_RESFILEPATH: /var/www/html/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 250M, Max POST 250M, Memory: 256M, Total max file upload: 250M
Resource folder writeable: Yes
HTTP_HOST: scottgruber.me
DOCUMENT_ROOT: /var/www/html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Some other info in my diagnostics that may be related

PERCH_SSL: true
HTTPS: on
perch_kraken_api_key: ***
perch_kraken_api_secret: ***
perch_kraken_url: https://www.scottgruber.me

Here is the template code.

<img src="<perch:content type="image" id="image" label="Image" bucket="images" />" alt="<perch:content type="text" id="alt" label="Description" required="false" help="Photo alt tag" title="true" />" />

And here is the debug output when I upload an image.

Debug Message
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='7a2b7fd8613d0e74f6093022418bcb2d' LIMIT 1
UPDATE perch2_users SET userHash='5e2f3ede36e788d9fa01feec5442a941' WHERE userID='1'
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT collectionID, collectionKey FROM perch2_collections WHERE collectionInAppMenu=1 ORDER BY collectionOrder ASC
SELECT * FROM perch2_content_regions WHERE regionID=26 LIMIT 1
SELECT * FROM perch2_pages WHERE pageID='5' LIMIT 1
SELECT * FROM perch2_content_items WHERE regionID=26 AND itemRev=1 ORDER BY itemOrder ASC
SELECT * FROM perch2_content_items WHERE regionID=26 AND itemRev=1 ORDER BY itemOrder ASC
Using template: /templates/content/image.html
INSERT INTO perch2_content_items (itemID, regionID, pageID, itemRev, itemOrder, itemJSON, itemSearch, itemUpdatedBy) SELECT itemID, regionID, pageID, 2 AS itemRev, itemOrder, itemJSON, itemSearch, '1' AS itemUpdatedBy FROM perch2_content_items WHERE regionID=26 AND itemRev=1 ORDER BY itemOrder ASC
REPLACE INTO perch2_resource_log (appID, itemFK, itemRowID, resourceID) SELECT cr.appID, cr.itemFK, c2.itemRowID, cr.resourceID FROM perch2_resource_log cr, perch2_content_items c1, perch2_content_items c2 WHERE cr.appID='content' AND cr.itemFK='itemRowID' AND cr.itemRowID=c1.itemRowID AND c1.itemID = c2.itemID AND c1.regionID=26 AND c2.regionID=26 AND c1.itemRev = 1 AND c2.itemRev = 2
SELECT itemRowID FROM perch2_content_items WHERE regionID=26 AND itemRev=2 ORDER BY itemOrder ASC
UPDATE perch2_content_items SET itemOrder=1000 WHERE itemRowID='86'
UPDATE perch2_content_regions SET regionLatestRev=2 WHERE regionID='26'
SELECT regionRev FROM perch2_content_regions WHERE regionID=26
DELETE FROM perch2_content_items WHERE regionID=26 AND itemRev!=1 AND itemRev IN (SELECT itemRev FROM (SELECT DISTINCT itemRev FROM perch2_content_items WHERE regionID=26 ORDER BY itemRev DESC LIMIT 8, 99999) AS t2)
DELETE FROM perch2_resource_log WHERE appID='content' AND itemFK='itemRowID' AND itemRowID NOT IN (SELECT itemRowID FROM perch2_content_items)
SELECT * FROM perch2_content_items WHERE regionID=26 AND itemRev=2 ORDER BY itemOrder ASC
DELETE FROM perch2_resource_log WHERE appID='content' AND itemFK='itemRowID' AND itemRowID='86'
SELECT * FROM perch2_resources WHERE resourceID='26' LIMIT 1
SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='26' AND resourceKey='thumb'
Resizing image... (gd, w150 h150 @2x thumb)
Array
(
    [dev] =>
    [url] => s3://www-scottgruber-me/images/grapes-thumb@2x.png
    [callback_url] => https://www.scottgruber.me/perch/addons/apps/perch_kraken/callback/
    [wait] =>
)
Array
(
    [id] => 932c4d09390a7373b136080d80ba6a2a
)
INSERT INTO perch2_kraken_jobs(jobID,file_name,file_path) VALUES('932c4d09390a7373b136080d80ba6a2a','grapes-thumb@2x.png','s3://www-scottgruber-me/images/grapes-thumb@2x.png')
Invalid query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_scottgruber.perch2_kraken_jobs' doesn't exist
INSERT IGNORE INTO perch2_resources(resourceApp,resourceBucket,resourceFile,resourceKey,resourceParentID,resourceType,resourceCreated,resourceInLibrary,resourceWidth,resourceHeight,resourceTargetWidth,resourceTargetHeight,resourceDensity,resourceFileSize,resourceMimeType,resourceTitle) VALUES('content','images','grapes-thumb@2x.png','thumb','26','png','2015-06-22 11:16:56','0',150,112,150,150,2,93319,'image/png','Grapes thumb@2x')
SELECT resourceID FROM perch2_resources WHERE resourceBucket='images' AND resourceFile='grapes-thumb@2x.png' LIMIT 1
INSERT IGNORE INTO perch2_resource_log(`appID`, `itemFK`, `itemRowID`, `resourceID`) VALUES('content','itemRowID',86,26),('content','itemRowID',86,14)
UPDATE perch2_content_items SET itemJSON='{\"_id\":\"21\",\"image\":{\"assetID\":\"26\",\"title\":\"Grapes\",\"_default\":\"https:\\/\\/dtpytik42o9dr.cloudfront.net\\/images\\/grapes.png\",\"bucket\":\"images\",\"path\":\"grapes.png\",\"size\":1405001,\"w\":2048,\"h\":1536,\"mime\":\"image\\/png\",\"sizes\":{\"thumb\":{\"w\":150,\"h\":112,\"target_w\":150,\"target_h\":150,\"density\":2,\"path\":\"grapes-thumb@2x.png\",\"size\":93319,\"mime\":\"image\\/png\"}}},\"alt\":\"Grapes\",\"_title\":\"Grapes\"}', itemSearch=' Grapes ' WHERE itemRowID='86'
SELECT * FROM perch2_content_items WHERE regionID=26 AND itemRev=2 ORDER BY itemOrder ASC
Using template: /templates/content/image.html
UPDATE perch2_content_regions SET regionHTML='<img src=\"https://dtpytik42o9dr.cloudfront.net/images/grapes.png\" alt=\"Grapes\" />\n', regionRev=2, regionLatestRev=2 WHERE regionID='26'
Setting alert: Content successfully updated (success)
SELECT * FROM perch2_resources WHERE resourceApp='content' AND resourceInLibrary=0 AND resourceCreated<'2015-06-21 11:16:56' AND resourceID NOT IN (SELECT resourceID FROM perch2_resource_log)
SELECT MIN(itemRev) FROM perch2_content_items WHERE regionID=26
DELETE FROM perch2_content_index WHERE regionID=26 AND itemRev<0
SELECT * FROM perch2_content_items WHERE regionID=26 AND itemRev=2 ORDER BY itemOrder ASC
DELETE FROM perch2_content_index WHERE regionID=26 AND itemRev=2
Using template: /templates/content/image.html
INSERT INTO perch2_content_index (itemID, regionID, pageID, itemRev, indexKey, indexValue) VALUES (21,26,5,2,'image','https://dtpytik42o9dr.cloudfront.net/images/grapes.png'),(21,26,5,2,'alt','Grapes'),(21,26,5,2,'_id',21),(21,26,5,2,'_order','1000')
OPTIMIZE TABLE perch2_content_index
UPDATE perch2_pages SET pageModified='2015-06-22 11:16:56' WHERE pageID='5'
SELECT * FROM perch2_content_items WHERE regionID=26 AND itemRev=2 ORDER BY itemOrder ASC
Queries: 48
Memory: 5.8232

Scott Gruber

Scott Gruber 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that table should be created. What do you see when you visit the Kraken app?

The table perch2_kraken_jobs was created when I visited the Perch Kraken app. (I hadn't tried to visit that page before.)

I see screen when I clicked Kraken on the Apps menu that says Recent Jobs with the following values in a table. Its status says pending and is stalled there on the automatically created thumb. Doubtful but could the @ in the file name be an issue? (I sent an email to support@kraken.io to ask just in case, but didn't see specifics on file naming rules in the kraken api docs). The image I uploaded was named santa-monica.png. Both it and the thumbnail santa-monica-thumb@2x.png get to Amazon s3.

Here is the Debug Message

Debug Message
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='4caa6eda53ad35cf907b3071a7090bfa' LIMIT 1
UPDATE perch2_users SET userHash='dcda13c195ec6ed9e8a7ea575465e29e' WHERE userID='1'
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT collectionID, collectionKey FROM perch2_collections WHERE collectionInAppMenu=1 ORDER BY collectionOrder ASC
SELECT SQL_CALC_FOUND_ROWS DISTINCT * FROM perch2_kraken_jobs ORDER BY jobCreated DESC LIMIT 0, 24
SELECT FOUND_ROWS() AS `count`

I tried to upload a couple of other images (in this case named circlex.jpg. I checked and the two images were uploaded to AWS S3. In Perch when I uploaded I can see a thumb momentarily flash, but then no thumb show up in Perch Assets. Here is a screenshot of the results, which shows no thumb.

https://www.dropbox.com/s/t0swlv8whlvpnwq/assets-screenshot.jpg?dl=0

Also, no change inside the kraken app Pending Jobs.

Here is a screenshot https://www.dropbox.com/s/m7gvu14wtud5bhr/kraken-jobs-screenshot.jpg?dl=0

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you tried with a local bucket?

Sorry, Yes, local buckets do work. Apparently stalls on the s3. Tested with 3 local uploads all 3 worked, then switched back to s3, then stalled as before. Here is a screenshot on the Kraken page.

https://www.dropbox.com/s/7bz2bcm59r24e50/kraken-local-screenshot.png?dl=0

Drew McLellan

Drew McLellan 2638 points
Perch Support

It sounds like it could be a bug, so I'll have to file it and investigate.

Drew McLellan

Drew McLellan 2638 points
Perch Support

With debug on, can you try adding an image to a region using a new image dimension that you've not used before?

That should then create a new image size and send it to Kraken. The parameters used are written out to the debug when you save the region.

Doing some reading on the kraken amazon s3 support page and found this.

region — Name of the region your S3 bucket is located in. This field is mandatory if the region is different from the default one (us-east-1). The full list of S3 regions can be found here.

I'm using us-west-2 region in Oregon. I'll create a new Amazon s3 instance for us-east-1 and report back.

I see now in the Perch docs:

Note: this has been tested successfully with buckets in the default US region - buckets in other datacenters should work but may need configuration tweaking.

Is there a way to set which region Perch points to if not the default? If not maybe add a value in the array or something like it for Perch 2.9.

As an aside, I went with us-west-2 because its closer to my web server host and sustainably powered with a 100% carbon neutral infrastructure. aws and sustainability

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are images otherwise going onto S3 and working? If so that's probably not the cause.

Thanks Drew.

Yes, they are getting to s3. I'm using CloudFront btw, but here is a pic I uploaded.

https://s3-us-west-2.amazonaws.com/www-scottgruber-me/images/image.jpg

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's a very nice picture.

Any luck with that debug?

Hmm.

Tested with two s3 buckets. Both tests results show up on front page, which is good, but seems like no kraken compression. Probably a low-priority bug in kraken.

One default on US Standard.

Images upload ok, but kraken_app says pending. Images do display on front page whether in an images folder or not. ex here https://s3.amazonaws.com/scottgruber-me/male-mask-thumb%402x.jpg or here https://s3.amazonaws.com/scottgruber-me/images/black-lagoon-thumb%402x.jpg

Second test back on US West-2

Images upload ok, again, kraken_app says pending. https://s3-us-west-2.amazonaws.com/www-scottgruber-me/images/black-lagoon-us-west-test-thumb%402x.jpg

link to screenshot of in kraken showing pending.

kraken-pending-screenshot.png

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you try those debugging steps?

Sorry, just saw those debugging steps. Will do.

I created a new region in a master page called test kraken image, then uploaded 3 images on 3 pages each image at a different resolutions. All show up on the site.

  1. https://scottgruber.me/notes new image is windmill 3264 x 2448 https://dtpytik42o9dr.cloudfront.net/images/windmill.jpg
  2. https://scottgruber.me/articles new image is cat photo 2683 x 1302 https://dtpytik42o9dr.cloudfront.net/images/fuzzy-b-kitty.jpg
  3. https://scottgruber.me/about new image is windmill 2800 x 2100 https://dtpytik42o9dr.cloudfront.net/images/windmill-2800.jpg

Results

  • windmill.jpg failed to show up on the kraken app, no thumb display in assets. displays on page.
  • fuzzy-b-kitty.jpg and windmill-2800.jpg show as pending in the kraken app as pending, thumbs show up in assets. displays on page

Here is screenshot in kraken app https://www.dropbox.com/s/35ia4e6jr332lo6/kraken-pending2-screenshot.png?dl=0

Here is the debug info for the 3 querries.

Debug Message
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='64eb145edcfe06de4fe85055462c515c' LIMIT 1
UPDATE perch2_users SET userHash='8c419b41e3d19b7e9bd2144a4606ec02' WHERE userID='1'
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT collectionID, collectionKey FROM perch2_collections WHERE collectionInAppMenu=1 ORDER BY collectionOrder ASC
SELECT * FROM perch2_content_regions WHERE regionID=29 LIMIT 1
SELECT * FROM perch2_pages WHERE pageID='25' LIMIT 1
SELECT * FROM perch2_content_items WHERE regionID=29 AND itemRev=0 ORDER BY itemOrder ASC
SELECT * FROM perch2_content_items WHERE regionID=29 AND itemRev=0 ORDER BY itemOrder ASC
Using template: /templates/content/image.html
INSERT INTO perch2_content_items (itemID, regionID, pageID, itemRev, itemOrder, itemJSON, itemSearch, itemUpdatedBy) SELECT itemID, regionID, pageID, 1 AS itemRev, itemOrder, itemJSON, itemSearch, '1' AS itemUpdatedBy FROM perch2_content_items WHERE regionID=29 AND itemRev=0 ORDER BY itemOrder ASC
REPLACE INTO perch2_resource_log (appID, itemFK, itemRowID, resourceID) SELECT cr.appID, cr.itemFK, c2.itemRowID, cr.resourceID FROM perch2_resource_log cr, perch2_content_items c1, perch2_content_items c2 WHERE cr.appID='content' AND cr.itemFK='itemRowID' AND cr.itemRowID=c1.itemRowID AND c1.itemID = c2.itemID AND c1.regionID=29 AND c2.regionID=29 AND c1.itemRev = 0 AND c2.itemRev = 1
SELECT itemRowID FROM perch2_content_items WHERE regionID=29 AND itemRev=1 ORDER BY itemOrder ASC
UPDATE perch2_content_items SET itemOrder=1000 WHERE itemRowID='111'
UPDATE perch2_content_regions SET regionLatestRev=1, regionRev=1 WHERE regionID='29'
SELECT regionRev FROM perch2_content_regions WHERE regionID=29
DELETE FROM perch2_content_items WHERE regionID=29 AND itemRev!=1 AND itemRev IN (SELECT itemRev FROM (SELECT DISTINCT itemRev FROM perch2_content_items WHERE regionID=29 ORDER BY itemRev DESC LIMIT 8, 99999) AS t2)
DELETE FROM perch2_resource_log WHERE appID='content' AND itemFK='itemRowID' AND itemRowID NOT IN (SELECT itemRowID FROM perch2_content_items)
SELECT * FROM perch2_content_items WHERE regionID=29 AND itemRev=1 ORDER BY itemOrder ASC
DELETE FROM perch2_resource_log WHERE appID='content' AND itemFK='itemRowID' AND itemRowID='111'
SELECT * FROM perch2_resources WHERE resourceID='50' LIMIT 1
SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='50' AND resourceKey='thumb'
Resizing image... (gd, w150 h150 @2x thumb)
INSERT IGNORE INTO perch2_resource_log(`appID`, `itemFK`, `itemRowID`, `resourceID`) VALUES('content','itemRowID',111,50),('content','itemRowID',111,50)
UPDATE perch2_content_items SET itemJSON='{\"_id\":\"24\",\"image\":{\"assetID\":\"50\",\"title\":\"Windmill\",\"_default\":\"https:\\/\\/dtpytik42o9dr.cloudfront.net\\/images\\/windmill.jpg\",\"bucket\":\"images\",\"path\":\"windmill.jpg\",\"size\":1555077,\"mime\":\"ERROR: cannot open `s3:\\/\\/www-scottgruber-me\\/images\\/windmill.jpg\' (No such file or directory)\\n\"},\"alt\":null}', itemSearch=' ' WHERE itemRowID='111'
SELECT * FROM perch2_content_items WHERE regionID=29 AND itemRev=1 ORDER BY itemOrder ASC
Using template: /templates/content/image.html
UPDATE perch2_content_regions SET regionHTML='<img src=\"https://dtpytik42o9dr.cloudfront.net/images/windmill.jpg\" alt=\"\" />\n', regionRev=1, regionLatestRev=1 WHERE regionID='29'
Setting alert: Content successfully updated (success)
SELECT * FROM perch2_resources WHERE resourceApp='content' AND resourceInLibrary=0 AND resourceCreated<'2015-06-22 09:39:27' AND resourceID NOT IN (SELECT resourceID FROM perch2_resource_log)
SELECT MIN(itemRev) FROM perch2_content_items WHERE regionID=29
DELETE FROM perch2_content_index WHERE regionID=29 AND itemRev<0
SELECT * FROM perch2_content_items WHERE regionID=29 AND itemRev=1 ORDER BY itemOrder ASC
DELETE FROM perch2_content_index WHERE regionID=29 AND itemRev=1
Using template: /templates/content/image.html
INSERT INTO perch2_content_index (itemID, regionID, pageID, itemRev, indexKey, indexValue) VALUES (24,29,25,1,'image','https://dtpytik42o9dr.cloudfront.net/images/windmill.jpg'),(24,29,25,1,'alt',''),(24,29,25,1,'_id',24),(24,29,25,1,'_order','1000')
OPTIMIZE TABLE perch2_content_index
UPDATE perch2_pages SET pageModified='2015-06-23 09:39:27' WHERE pageID='25'
SELECT * FROM perch2_content_items WHERE regionID=29 AND itemRev=1 ORDER BY itemOrder ASC
Queries: 46
Memory: 5.5883
Array
(
    [type] => 2
    [message] => finfo_file(): Failed identify data 0:invalid mode 00
    [file] => /var/www/html/perch/core/lib/PerchImage.class.php
    [line] => 402
)
Debug Message
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='a0f5ee60f93660345079f930c96f0377' LIMIT 1
UPDATE perch2_users SET userHash='1324848b91b3236e5d2291e253b36a54' WHERE userID='1'
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT collectionID, collectionKey FROM perch2_collections WHERE collectionInAppMenu=1 ORDER BY collectionOrder ASC
SELECT * FROM perch2_content_regions WHERE regionID=30 LIMIT 1
SELECT * FROM perch2_pages WHERE pageID='5' LIMIT 1
SELECT * FROM perch2_content_items WHERE regionID=30 AND itemRev=0 ORDER BY itemOrder ASC
SELECT * FROM perch2_content_items WHERE regionID=30 AND itemRev=0 ORDER BY itemOrder ASC
Using template: /templates/content/image.html
INSERT INTO perch2_content_items (itemID, regionID, pageID, itemRev, itemOrder, itemJSON, itemSearch, itemUpdatedBy) SELECT itemID, regionID, pageID, 1 AS itemRev, itemOrder, itemJSON, itemSearch, '1' AS itemUpdatedBy FROM perch2_content_items WHERE regionID=30 AND itemRev=0 ORDER BY itemOrder ASC
REPLACE INTO perch2_resource_log (appID, itemFK, itemRowID, resourceID) SELECT cr.appID, cr.itemFK, c2.itemRowID, cr.resourceID FROM perch2_resource_log cr, perch2_content_items c1, perch2_content_items c2 WHERE cr.appID='content' AND cr.itemFK='itemRowID' AND cr.itemRowID=c1.itemRowID AND c1.itemID = c2.itemID AND c1.regionID=30 AND c2.regionID=30 AND c1.itemRev = 0 AND c2.itemRev = 1
SELECT itemRowID FROM perch2_content_items WHERE regionID=30 AND itemRev=1 ORDER BY itemOrder ASC
UPDATE perch2_content_items SET itemOrder=1000 WHERE itemRowID='113'
UPDATE perch2_content_regions SET regionLatestRev=1, regionRev=1 WHERE regionID='30'
SELECT regionRev FROM perch2_content_regions WHERE regionID=30
DELETE FROM perch2_content_items WHERE regionID=30 AND itemRev!=1 AND itemRev IN (SELECT itemRev FROM (SELECT DISTINCT itemRev FROM perch2_content_items WHERE regionID=30 ORDER BY itemRev DESC LIMIT 8, 99999) AS t2)
DELETE FROM perch2_resource_log WHERE appID='content' AND itemFK='itemRowID' AND itemRowID NOT IN (SELECT itemRowID FROM perch2_content_items)
SELECT * FROM perch2_content_items WHERE regionID=30 AND itemRev=1 ORDER BY itemOrder ASC
DELETE FROM perch2_resource_log WHERE appID='content' AND itemFK='itemRowID' AND itemRowID='113'
SELECT * FROM perch2_resources WHERE resourceID='51' LIMIT 1
SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='51' AND resourceKey='thumb'
INSERT IGNORE INTO perch2_resource_log(`appID`, `itemFK`, `itemRowID`, `resourceID`) VALUES('content','itemRowID',113,51),('content','itemRowID',113,52),('content','itemRowID',113,51),('content','itemRowID',113,52)
UPDATE perch2_content_items SET itemJSON='{\"_id\":\"25\",\"image\":{\"assetID\":\"51\",\"title\":\"Fuzzy b kitty\",\"_default\":\"https:\\/\\/dtpytik42o9dr.cloudfront.net\\/images\\/fuzzy-b-kitty.jpg\",\"bucket\":\"images\",\"path\":\"fuzzy-b-kitty.jpg\",\"size\":493088,\"w\":2683,\"h\":1302,\"mime\":\"image\\/jpeg\",\"sizes\":{\"thumb\":{\"w\":\"150\",\"h\":\"72\",\"target_w\":150,\"target_h\":150,\"density\":2,\"path\":\"fuzzy-b-kitty-thumb@2x.jpg\",\"size\":10880,\"mime\":\"\",\"assetID\":\"52\"}}},\"alt\":null}', itemSearch=' ' WHERE itemRowID='113'
SELECT * FROM perch2_content_items WHERE regionID=30 AND itemRev=1 ORDER BY itemOrder ASC
Using template: /templates/content/image.html
UPDATE perch2_content_regions SET regionHTML='<img src=\"https://dtpytik42o9dr.cloudfront.net/images/fuzzy-b-kitty.jpg\" alt=\"\" />\n', regionRev=1, regionLatestRev=1 WHERE regionID='30'
Setting alert: Content successfully updated (success)
SELECT * FROM perch2_resources WHERE resourceApp='content' AND resourceInLibrary=0 AND resourceCreated<'2015-06-22 09:43:17' AND resourceID NOT IN (SELECT resourceID FROM perch2_resource_log)
SELECT MIN(itemRev) FROM perch2_content_items WHERE regionID=30
DELETE FROM perch2_content_index WHERE regionID=30 AND itemRev<0
SELECT * FROM perch2_content_items WHERE regionID=30 AND itemRev=1 ORDER BY itemOrder ASC
DELETE FROM perch2_content_index WHERE regionID=30 AND itemRev=1
Using template: /templates/content/image.html
INSERT INTO perch2_content_index (itemID, regionID, pageID, itemRev, indexKey, indexValue) VALUES (25,30,5,1,'image','https://dtpytik42o9dr.cloudfront.net/images/fuzzy-b-kitty.jpg'),(25,30,5,1,'alt',''),(25,30,5,1,'_id',25),(25,30,5,1,'_order','1000')
OPTIMIZE TABLE perch2_content_index
UPDATE perch2_pages SET pageModified='2015-06-23 09:43:17' WHERE pageID='5'
SELECT * FROM perch2_content_items WHERE regionID=30 AND itemRev=1 ORDER BY itemOrder ASC
Queries: 46
Memory: 6.2576
Debug Message
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='714d7f2c5a46b19f91a10647c631b49f' LIMIT 1
UPDATE perch2_users SET userHash='47f87d43b7235efd15f8ec45f0f2c45f' WHERE userID='1'
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT collectionID, collectionKey FROM perch2_collections WHERE collectionInAppMenu=1 ORDER BY collectionOrder ASC
SELECT * FROM perch2_content_regions WHERE regionID=28 LIMIT 1
SELECT * FROM perch2_pages WHERE pageID='26' LIMIT 1
SELECT * FROM perch2_content_items WHERE regionID=28 AND itemRev=0 ORDER BY itemOrder ASC
SELECT * FROM perch2_content_items WHERE regionID=28 AND itemRev=0 ORDER BY itemOrder ASC
Using template: /templates/content/image.html
INSERT INTO perch2_content_items (itemID, regionID, pageID, itemRev, itemOrder, itemJSON, itemSearch, itemUpdatedBy) SELECT itemID, regionID, pageID, 1 AS itemRev, itemOrder, itemJSON, itemSearch, '1' AS itemUpdatedBy FROM perch2_content_items WHERE regionID=28 AND itemRev=0 ORDER BY itemOrder ASC
REPLACE INTO perch2_resource_log (appID, itemFK, itemRowID, resourceID) SELECT cr.appID, cr.itemFK, c2.itemRowID, cr.resourceID FROM perch2_resource_log cr, perch2_content_items c1, perch2_content_items c2 WHERE cr.appID='content' AND cr.itemFK='itemRowID' AND cr.itemRowID=c1.itemRowID AND c1.itemID = c2.itemID AND c1.regionID=28 AND c2.regionID=28 AND c1.itemRev = 0 AND c2.itemRev = 1
SELECT itemRowID FROM perch2_content_items WHERE regionID=28 AND itemRev=1 ORDER BY itemOrder ASC
UPDATE perch2_content_items SET itemOrder=1000 WHERE itemRowID='115'
UPDATE perch2_content_regions SET regionLatestRev=1, regionRev=1 WHERE regionID='28'
SELECT regionRev FROM perch2_content_regions WHERE regionID=28
DELETE FROM perch2_content_items WHERE regionID=28 AND itemRev!=1 AND itemRev IN (SELECT itemRev FROM (SELECT DISTINCT itemRev FROM perch2_content_items WHERE regionID=28 ORDER BY itemRev DESC LIMIT 8, 99999) AS t2)
DELETE FROM perch2_resource_log WHERE appID='content' AND itemFK='itemRowID' AND itemRowID NOT IN (SELECT itemRowID FROM perch2_content_items)
SELECT * FROM perch2_content_items WHERE regionID=28 AND itemRev=1 ORDER BY itemOrder ASC
DELETE FROM perch2_resource_log WHERE appID='content' AND itemFK='itemRowID' AND itemRowID='115'
SELECT * FROM perch2_resources WHERE resourceID='53' LIMIT 1
SELECT * FROM perch2_resources WHERE resourceAWOL=0 AND resourceParentID='53' AND resourceKey='thumb'
INSERT IGNORE INTO perch2_resource_log(`appID`, `itemFK`, `itemRowID`, `resourceID`) VALUES('content','itemRowID',115,53),('content','itemRowID',115,54),('content','itemRowID',115,53),('content','itemRowID',115,54)
UPDATE perch2_content_items SET itemJSON='{\"_id\":\"26\",\"image\":{\"assetID\":\"53\",\"title\":\"Windmill 2800\",\"_default\":\"https:\\/\\/dtpytik42o9dr.cloudfront.net\\/images\\/windmill-2800.jpg\",\"bucket\":\"images\",\"path\":\"windmill-2800.jpg\",\"size\":773674,\"w\":2800,\"h\":2100,\"mime\":\"image\\/jpeg\",\"sizes\":{\"thumb\":{\"w\":\"150\",\"h\":\"112\",\"target_w\":150,\"target_h\":150,\"density\":2,\"path\":\"windmill-2800-thumb@2x.jpg\",\"size\":14219,\"mime\":\"\",\"assetID\":\"54\"}}},\"alt\":null}', itemSearch=' ' WHERE itemRowID='115'
SELECT * FROM perch2_content_items WHERE regionID=28 AND itemRev=1 ORDER BY itemOrder ASC
Using template: /templates/content/image.html
UPDATE perch2_content_regions SET regionHTML='<img src=\"https://dtpytik42o9dr.cloudfront.net/images/windmill-2800.jpg\" alt=\"\" />\n', regionRev=1, regionLatestRev=1 WHERE regionID='28'
Setting alert: Content successfully updated (success)
SELECT * FROM perch2_resources WHERE resourceApp='content' AND resourceInLibrary=0 AND resourceCreated<'2015-06-22 09:46:04' AND resourceID NOT IN (SELECT resourceID FROM perch2_resource_log)
SELECT MIN(itemRev) FROM perch2_content_items WHERE regionID=28
DELETE FROM perch2_content_index WHERE regionID=28 AND itemRev<0
SELECT * FROM perch2_content_items WHERE regionID=28 AND itemRev=1 ORDER BY itemOrder ASC
DELETE FROM perch2_content_index WHERE regionID=28 AND itemRev=1
Using template: /templates/content/image.html
INSERT INTO perch2_content_index (itemID, regionID, pageID, itemRev, indexKey, indexValue) VALUES (26,28,26,1,'image','https://dtpytik42o9dr.cloudfront.net/images/windmill-2800.jpg'),(26,28,26,1,'alt',''),(26,28,26,1,'_id',26),(26,28,26,1,'_order','1000')
OPTIMIZE TABLE perch2_content_index
UPDATE perch2_pages SET pageModified='2015-06-23 09:46:04' WHERE pageID='26'
SELECT * FROM perch2_content_items WHERE regionID=28 AND itemRev=1 ORDER BY itemOrder ASC
Queries: 46
Memory: 6.258
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, thanks, leave it with me and I'll see what I can find out.