Bake shell core cache `$prefix` generation using app's name #439

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
5 participants
Contributor

tigrang commented Jan 23, 2012

Follow up to #438 in case its wanted.

Owner

lorenzo commented Jan 23, 2012

A test case would be ideal! What do you say?

Contributor

tigrang commented Jan 23, 2012

Let there be test!

Sorry didn't realize there were test for these :)

Edit: Simplifying the test. Will amend shortly.

Owner

markstory commented Jan 23, 2012

Test all the things!

Contributor

tigrang commented Jan 23, 2012

@markstory did I break something else, or do you mean don't simplify (where some cases are missed).

Member

josegonzalez commented Jan 23, 2012

I think he meant run AllTests

@ceeram ceeram commented on the diff Jan 23, 2012

lib/Cake/Console/Command/Task/ProjectTask.php
@@ -300,6 +307,26 @@ public function securityCipherSeed($path) {
}
/**
+ * Writes cache prefix using app's name
+ *
+ * @param string $dir Path to project
+ * @return boolean Success
+ */
+ public function cachePrefix($dir) {
@ceeram

ceeram Jan 23, 2012

Member

This will not help when installing multiple complete cakephp installs on shared server, which all use app as dirname.
Edit: sorry, didnt see this was for baked projects.

Owner

markstory commented Jan 23, 2012

Unfunny joke is not funny. I was trying to comment on us having tests for things some projects wouldn't.

Contributor

tigrang commented Jan 23, 2012

sorry for being slower than php @markstory :)

Owner

markstory commented Aug 24, 2012

Anyone against putting this into 2.3? I'll manually merge the changes in.

markstory was assigned Aug 24, 2012

Member

ceeram commented Aug 24, 2012

+1
Edit: +1 on merging, not being against it :)

@tigrang tigrang commented on the diff Aug 24, 2012

lib/Cake/Console/Command/Task/ProjectTask.php
@@ -300,6 +307,26 @@ public function securityCipherSeed($path) {
}
/**
+ * Writes cache prefix using app's name
+ *
+ * @param string $dir Path to project
+ * @return boolean Success
+ */
+ public function cachePrefix($dir) {
+ $app = basename($dir);
+ $File = new File($dir . 'Config' . DS . 'core.php');
+ $contents = $File->read();
+ if (preg_match('/(\$prefix = \'myapp_\';)/', $contents, $match)) {
+ $result = str_replace($match[0], '$prefix = \'' . $app . '_\';', $contents);
+ if ($File->write($result)) {
@tigrang

tigrang Aug 24, 2012

Contributor

This should be changed to just return $File->write($result); This was a copy-paste from another method, so it could be fixed in other places, too.

Owner

markstory commented Aug 25, 2012

Rebased and merged in [0441c9f]

markstory closed this Aug 25, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment