From 042edba086bbcb1cee608c6e01e477c2326acd03 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 21 Mar 2022 14:38:40 -0500 Subject: [PATCH 01/10] version bump --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index dee6c32b2a..3f7d8d960f 100644 --- a/box.json +++ b/box.json @@ -1,6 +1,6 @@ { "name":"ContentBox Tester Site", - "version":"5.1.1", + "version":"5.2.0", "author":"Ortus Solutions ", "shortDescription":"A tester site for developing the ContentBox Modular CMS", "type":"cms", From 362b9186d782edce3c091ce61c20aa81c486a6f6 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 25 Mar 2022 15:11:46 -0500 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20making=20sure=20pr'?= =?UTF-8?q?s=20run=20only=20for=20pull=20requests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index f90d660f7b..0b12984295 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,11 +1,6 @@ name: Pull Requests on: - push: - branches-ignore: - - "main" - - "master" - - "development" pull_request: branches: - development From 79d77f59d92aaf4760fb117282e8a06d16a7955b Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 25 Mar 2022 15:12:01 -0500 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=91=8C=20IMPROVE:=20Make=20sure=20t?= =?UTF-8?q?he=20updater=20goes=20to=20the=20latest=20v5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/patches/5.0.0/Updater.cfc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/patches/5.0.0/Updater.cfc b/build/patches/5.0.0/Updater.cfc index 62682dcfba..6c71dbf341 100644 --- a/build/patches/5.0.0/Updater.cfc +++ b/build/patches/5.0.0/Updater.cfc @@ -1,5 +1,5 @@ /** - * Update a v4 Installation to v5.0.0 + * Update a v4 Installation to v5 */ component { @@ -8,7 +8,7 @@ component { variables.cwd = getCWD(); variables.tempFolder = variables.cwd & "__temp"; - variables.targetVersion = "5.0.0"; + variables.targetVersion = "5"; if( directoryExists( variables.tempFolder ) ){ directoryDelete( variables.tempFolder, true ); @@ -84,7 +84,7 @@ component { // Update ContentBox print.blueLine( "Uninstalling current version of the ContentBox module..." ).toConsole(); command( "uninstall contentbox" ).run(); - print.blueLine( "Installing ContentBox v5.0.0" ).toConsole(); + print.blueLine( "Installing ContentBox v#variables.targetVersion#" ).toConsole(); command( "install contentbox@#variables.targetVersion# --save" ).run(); print.greenLine( "√ ContentBox v5 Installed!" ).toConsole(); @@ -104,7 +104,7 @@ component { // Final Comment print.boldRedLine( - "√ Eureka! You are now ready to startup your engines and run ContentBox v5.0.0!" + "√ Eureka! You are now ready to startup your engines and run ContentBox v#variables.targetVersion#!" ) .toConsole(); } From 041e357edc78b2f2272de856c46569b159a5d0cf Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 25 Mar 2022 15:21:34 -0500 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20Updater=20is=20not?= =?UTF-8?q?=20running=20the=20right=20migrations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/patches/5.0.0/Updater.cfc | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/build/patches/5.0.0/Updater.cfc b/build/patches/5.0.0/Updater.cfc index 6c71dbf341..2ac7e95661 100644 --- a/build/patches/5.0.0/Updater.cfc +++ b/build/patches/5.0.0/Updater.cfc @@ -54,26 +54,13 @@ component { return; } - // install contentbox-site so we can copy over new assets and run our migrations + // Install ContentBox print.blueLine( "Downloading ContentBox v#variables.targetVersion# assets to __temp folder..." ).toConsole(); command( "install contentbox-site@#variables.targetVersion#" ) .inWorkingDirectory( variables.tempFolder ) .run(); print.greenLine( "√ ContentBox assets downloaded!" ).toConsole(); - // Copy over migration resources - print.blueLine( "Installing new ContentBox resources folder..." ).toConsole(); - if( !directoryExists( variables.cwd & "resources" ) ){ - directoryCreate( variables.cwd & "resources" ); - }; - copy( variables.tempFolder & "/resources", variables.cwd & "resources" ); - print.greenLine( "√ ContentBox resources installed!" ).toConsole(); - - // Run Migrations - print.blueLine( "Migrating your database to version: #variables.targetVersion#..." ).toConsole(); - command( "run-script contentbox:migrate:up" ).run(); - print.greenLine( "√ Database migrated! Let's do some code now." ).toConsole(); - // Update ColdBox print.blueLine( "Uninstalling current version of ColdBox..." ).toConsole(); command( "uninstall coldbox" ).run(); @@ -97,11 +84,16 @@ component { print.greenLine( "√ New ContentBox bin folder installed!" ).toConsole(); // Copy over new files - replaceNewFiles(); + replaceNewSiteFiles(); // Remove temp folder directoryDelete( variables.tempFolder, true ); + // Run Migrations + print.blueLine( "Migrating your database to version: #variables.targetVersion#..." ).toConsole(); + command( "run-script contentbox:migrate:up" ).run(); + print.greenLine( "√ Database migrated! Let's do some code now." ).toConsole(); + // Final Comment print.boldRedLine( "√ Eureka! You are now ready to startup your engines and run ContentBox v#variables.targetVersion#!" @@ -109,7 +101,7 @@ component { .toConsole(); } - function replaceNewFiles(){ + function replaceNewSiteFiles(){ print.blueLine( "Starting to deploy new files..." ).line().toConsole(); var files = [ From c09b0ea75425b04a1e08b454aaad3e5339721fb8 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Fri, 25 Mar 2022 15:55:49 -0500 Subject: [PATCH 05/10] rename migration as lucee chokes on the periods --- ...als.cfc => 2022_03_07_155812_v5_1_0_page_sslonly_removals.cfc} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename modules/contentbox/migrations/{2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc => 2022_03_07_155812_v5_1_0_page_sslonly_removals.cfc} (100%) diff --git a/modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc b/modules/contentbox/migrations/2022_03_07_155812_v5_1_0_page_sslonly_removals.cfc similarity index 100% rename from modules/contentbox/migrations/2022_03_07_155812_v5.1.0_page_sslonly_removals.cfc rename to modules/contentbox/migrations/2022_03_07_155812_v5_1_0_page_sslonly_removals.cfc From 575d314e1877208ff4b57ebfbb88799f5aac6c31 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Wed, 30 Mar 2022 18:59:44 -0500 Subject: [PATCH 06/10] CONTENTBOX-1413 #resolve CBHelper siteBaseURL is not accounting for multi-site --- modules/contentbox/models/system/CBHelper.cfc | 25 ++++++-- tests/Application.cfc | 7 ++- .../contentbox/unit/system/CBHelperTest.cfc | 61 +++++++++++++++++++ 3 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 tests/specs/contentbox-web/contentbox/unit/system/CBHelperTest.cfc diff --git a/modules/contentbox/models/system/CBHelper.cfc b/modules/contentbox/models/system/CBHelper.cfc index 2a88a78309..fcfcebb05c 100644 --- a/modules/contentbox/models/system/CBHelper.cfc +++ b/modules/contentbox/models/system/CBHelper.cfc @@ -101,6 +101,12 @@ component accessors="true" singleton threadSafe { */ any function setting( required key, defaultValue ){ var prc = getPrivateRequestCollection(); + + // See if all the settings are loaded, else lazy load them + if( isNull( prc.cbSettings ) || structIsEmpty( prc.cbSettings ) ){ + prc.cbSettings = variables.settingService.getAllSettings() + } + // return setting if it exists if ( structKeyExists( prc.cbSettings, arguments.key ) ) { return prc.cbSettings[ key ]; @@ -128,6 +134,11 @@ component accessors="true" singleton threadSafe { any function siteSetting( required key, defaultValue ){ var prc = getPrivateRequestCollection(); + // See if all the settings are loaded, else lazy load them + if( isNull( prc.cbSiteSettings ) || structIsEmpty( prc.cbSiteSettings ) ){ + prc.cbSiteSettings = variables.settingService.getAllSiteSettings( prc.oCurrentSite.getSlug() ) + } + // return setting if it exists if ( structKeyExists( prc.cbSiteSettings, arguments.key ) ) { return prc.cbSiteSettings[ key ]; @@ -298,14 +309,20 @@ component accessors="true" singleton threadSafe { */ function siteRoot( string siteID = "" ){ // Return the appropriate site Uri - return this.site( arguments.siteID ).getSiteRoot() & getPrivateRequestCollection().cbEntryPoint; + return this.site( arguments.siteID ).getSiteRoot() & getModuleConfig( "contentbox-ui" ).entryPoint; } /** - * Get the site base html ref URL + * Get the HTML base URL that is used for the HTML tag. This also accounts for SSL or not. + * + * @siteID The site id to get the root from, by default we use the current site you are on */ - function siteBaseURL(){ - return getRequestContext().getHTMLBaseUrl(); + function siteBaseURL( string siteID = "" ){ + return reReplaceNoCase( + this.siteRoot( arguments.siteID ), + "index.cfm\/?", + "" + ); } /** diff --git a/tests/Application.cfc b/tests/Application.cfc index 126c8c9fee..13f77a75a1 100755 --- a/tests/Application.cfc +++ b/tests/Application.cfc @@ -24,6 +24,11 @@ component{ // Turn on/off remote cfc content whitespace this.suppressRemoteComponentContent = false; + /************************************** + TESTING ENV + **************************************/ + createObject( "java", "java.lang.System" ).setProperty( "ENVIRONMENT", "testing" ); + // FILL OUT: THE LOCATION OF THE CONTENTBOX MODULE rootPath = replacenocase( replacenocase( getDirectoryFromPath( getCurrentTemplatePath() ), "tests\", "" ), "tests/", "" ); @@ -89,4 +94,4 @@ component{ } -} \ No newline at end of file +} diff --git a/tests/specs/contentbox-web/contentbox/unit/system/CBHelperTest.cfc b/tests/specs/contentbox-web/contentbox/unit/system/CBHelperTest.cfc new file mode 100644 index 0000000000..45c91ce153 --- /dev/null +++ b/tests/specs/contentbox-web/contentbox/unit/system/CBHelperTest.cfc @@ -0,0 +1,61 @@ +/** + * ContentBox - A Modular Content Platform + * Copyright since 2012 by Ortus Solutions, Corp + * www.ortussolutions.com/products/contentbox + * --- + */ +component extends="tests.resources.BaseTest" { + + /*********************************** BDD SUITES ***********************************/ + + function run( testResults, testBox ){ + describe( "CB Helper", function(){ + beforeEach( function( currentSpec ){ + setup(); + cbHelper = getInstance( "CBHelper@contentbox" ); + } ); + + it( "can be created", function(){ + expect( cbHelper ).toBeComponent(); + } ); + + describe( "Site related methods", function(){ + it( "can build the site root", function(){ + expect( cbHelper.siteRoot() ).toInclude( "http://127.0.0.1" ); + }); + + it( "can build the site base url", function(){ + expect( cbHelper.siteBaseUrl() ) + .toInclude( "http://127.0.0.1" ) + .notToInclude( "index.cfm" ); + }); + + it( "can build the site name", function(){ + expect( cbHelper.siteName() ).toInclude( "Default Site" ); + }); + + it( "can build the site tag line", function(){ + expect( cbHelper.siteTagLine() ).notToBeEmpty(); + }); + + it( "can build the site description", function(){ + expect( cbHelper.siteDescription() ).notToBeEmpty(); + }); + + it( "can build the site keywords", function(){ + cbHelper.siteKeywords(); + }); + + it( "can build the site email", function(){ + expect( cbHelper.siteEmail() ).notToBeEmpty(); + }); + + it( "can build the site outgoing email", function(){ + expect( cbHelper.siteOutgoingEmail() ).notToBeEmpty(); + }); + }); + + } ); + } + +} From 61ac0f4bd5afbe472b0cc350bb10c4148f019a74 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 31 Mar 2022 14:25:57 -0500 Subject: [PATCH 07/10] finalized changelog for patch release --- changelog.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 4f09db29ab..cc07941926 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ---- +## [5.1.2] => 2022-MAR-31 + +### Fixed + +- [CONTENTBOX-1415](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1415) 5.x Updater was not running the right migrations +- [CONTENTBOX-1414](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1414) Migration names cannot have a period or the migrations fail due to a CFC instantiation issue +- [CONTENTBOX-1413](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1413) CBHelper siteBaseURL is not accounting for multi-site + +---- + ## [5.1.1] => 2022-MAR-17 ### Fixed @@ -18,7 +28,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [CONTENTBOX-1412](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1412) VerifyPageLayout\(\) on the page rendering touches the filesystem on each request, removing this as it is not needed - [CONTENTBOX-1368](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1368) rc.pageUri is only the first segment of the actual slug, now it contains the full hierarchical slug - ---- ## [5.1.0] => 2022-MAR-17 From 9121cdaabc40cd02f34f2b21265bcbbece58272f Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 31 Mar 2022 14:29:50 -0500 Subject: [PATCH 08/10] adding test environment --- config/Coldbox.cfc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config/Coldbox.cfc b/config/Coldbox.cfc index f4ee413965..b6c95c7826 100755 --- a/config/Coldbox.cfc +++ b/config/Coldbox.cfc @@ -443,6 +443,13 @@ component { }; } + /** + * Testing Mode. + */ + function testing(){ + development(); + } + /** * Development environment * ORTUS DEVELOPMENT ENVIRONMENT, REMOVE FOR YOUR APP IF NEEDED From 1a3acc5636389afddd97b74b617f59219cbafdce Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 31 Mar 2022 14:38:03 -0500 Subject: [PATCH 09/10] dumb semicolon support. --- modules/contentbox/models/system/CBHelper.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/contentbox/models/system/CBHelper.cfc b/modules/contentbox/models/system/CBHelper.cfc index fcfcebb05c..5edb60725b 100644 --- a/modules/contentbox/models/system/CBHelper.cfc +++ b/modules/contentbox/models/system/CBHelper.cfc @@ -104,7 +104,7 @@ component accessors="true" singleton threadSafe { // See if all the settings are loaded, else lazy load them if( isNull( prc.cbSettings ) || structIsEmpty( prc.cbSettings ) ){ - prc.cbSettings = variables.settingService.getAllSettings() + prc.cbSettings = variables.settingService.getAllSettings(); } // return setting if it exists From 1b762129b2222bf4d500a64ee5442ccc82df8270 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 31 Mar 2022 14:43:40 -0500 Subject: [PATCH 10/10] another beautiful missing semi colon --- modules/contentbox/models/system/CBHelper.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/contentbox/models/system/CBHelper.cfc b/modules/contentbox/models/system/CBHelper.cfc index 5edb60725b..9229cfd48d 100644 --- a/modules/contentbox/models/system/CBHelper.cfc +++ b/modules/contentbox/models/system/CBHelper.cfc @@ -136,7 +136,7 @@ component accessors="true" singleton threadSafe { // See if all the settings are loaded, else lazy load them if( isNull( prc.cbSiteSettings ) || structIsEmpty( prc.cbSiteSettings ) ){ - prc.cbSiteSettings = variables.settingService.getAllSiteSettings( prc.oCurrentSite.getSlug() ) + prc.cbSiteSettings = variables.settingService.getAllSiteSettings( prc.oCurrentSite.getSlug() ); } // return setting if it exists