I'm trying to find something about CakePHP configuration, and I'm not having any luck googling and looking around.
I want to make a CakePHP app use "database.local.php" instead of "database.php", but I can't find the line in the app/Config files where the database file is defined as "database.php".
Does anyone know where it is defined so I can change it?
Thanks for your help ahead of time!
If i get it right, you want to have a local database... for development purpose?
If you want to switch the database due to your server-name, you can try to use:
http://www.edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp
Not quite an answer for you, but I wouldn't change it.
If you're using different files for different environments (dev, staging, production etc) you could use your naming convention, but have your deploy process rename the relevant file to whatever CakePHP's expecting. That is, have:
database.local.php
database.uat.php
database.live.php
or whatever, and just rename to database.php when deploying your code to one of those environments.
Related
I have finally my project ready to go live, is there a check list of things to go through before uploading the files to the webserver?
Are there any Files or Folders to be deleted before going live.
Version of cake: 2.3.8
I found out to set the debug level to 0.
Set the cookie in core.php
Do I need to remove the following folders?
/app/Console
/lib/Cake/Test
/lib/Cake/TestSuite
Any other security advise please?
Thanks a lot.
Don't deploy anything to production that isn't needed. If your project doesn't require those folders to function, then don't deploy them.
Make sure to check out the short deployment guide from the cake docs.
Also here's a more general website launch checklist.
I recommend making sure your deployment process resets caches appropriately. This can differ depending on how you have things set up, but by default CakePHP uses a file cache. Regardless, it can really hose you to let the cache linger when things should be updated like model schema, etc. For example, see my answer to another StackOverflow question.
I hope someone have already faced an issue to verify that application shows correct data from database. I reviewd how groovy used SQL, but I have no idea where and how I should do that. I'm just starting to use gradle+Spock+Geb for testing application. I have a few files where I described a couple of pages from application, a couple of modules and a file with spock specification. Where and how I need to connect to Oracle DB, use SQL and compare result's data with application's ones?
P.S. I write everything in notepad++ and launch from command line writing 'gradlew firefoxTest'. Does exist any more comfortable way to work with gradle+spock+geb?
Thanks in advance.
Because there are no other answers, I wanted to provide a solution someone at my company thought of. This assumes you already have a project that uses some sort of JDBC. In our case it is JDBI.
The idea is to extend Classloader and then use that to directly access the data access object class via the JVM. That idea should work.
I have not tested it out because it doesn't completely fit our use-case. I'll admit that this does not completely apply to your use case, but technically you could just run the jar of an existing project, which can access the database.
I have 2 source folders in my project:
src/main/resources/sql/oracle
src/main/resources/sql/sqlserver
They both have a file called mh1.sql.
The project I'm working on used to support only oracle database, so it just use ClassPathResource("mh1.sql") to load the sql file directly, now I need to support different kinds of database, and switch to the correct sql file according to the database type we're using. So, is there any good way to go? without any big impact on the old project. any rough ideas?
BTW, I find that after compilation, I can only find one mh1.sql under bin folder, I'm a new guy in using Eclipse, and I'm curious to know if it's possible to output these 2 folder oracle and sqlserver to the bin folder and each contains its own mh1.sql file?
As for your second question without knowing your exact Eclipse project settings it's of course close to impossible to tell why you're not seeing the oracle and sqlserver subfolders in your bin folder. However, it should be obvious that this being fixed is a prerequisite for your first problem.
Have a look at the ClassPathResource docs, they tell you that you can/should provide a path to your resource rather than just the name. Hence, you can use ClassPathResource("sql/oracle/mh1.sql").
Having said all that you might also just dump the two files in src/main/resources/sql/ (omitting the subfolders) and give them unique names: ora-mh1.sql and mssql-mh1.sql.
So for backing up any/all my WordPress sites i use a tool called "BACKUP BUDDY" and its
a great tool and all but lately its been really buggy and today finally it went kaboom!
Usually my workflow is that i develop the site on my local machine using WAMP/MAMP.
when done and ready for testing i use the tool, move it to my personal test server to test and when happy and work is approved, i move to the real server.
Since my tool stopped working(uploads half the content) i decided to just do it manually by installing Wordpress first on the real webserver(done), Applying my theme(done),
then exporting the database sql from the local server(done), and thereafter importing it to the real server(done) and the 2xs that ive done it the site comes up blank.(outcome equals major fail!)
im assuming that something has to be changed/done in order for it to work but not sure what.
unlike a normal DB where i can talk to the info as normal, since WP is a CMS im assuming that it ties the info to the domain but again, i dont know how it 100% works...
Any ideas as to what im doing wrong? because as of now, if i cant do it like this, id have to manually create ALL the pages. Plus, if i was going to then move it from my real test server to final real destination then id have to manually redo it all again...
Thanks in advanced.
you aren't doing anything wrong. It sounds like your particular workflow could be as follows.
Upload the contents of the site via FTP
Create & Import the database via PHPMyAdmin, changing any info in wp-config.php
Define the site url, in wp-config.php [See below]
Use a tool to find & replace any hard-coded site-urls that wordpress loves to use. [See below]
Example code:
Define site urls
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
Find replace tool
Replace
http://localhost/
with
http://www.your-new-site.com/
That should be it. It's live!
You can export it using phpMyAdmin and then use bigdump to import it. download bigdump from here and make sure you read the first note about the exporting process, found here
http://www.ozerov.de/bigdump/usage/
here is a bash script you can use to automate this entire process for you: https://github.com/jplew/SyncDB
I have been working on a system to push changes from my git repository to a live site. The issue is that on my local box (where only I have access) I leave db credentials defaults; but I don't want them to be defaults on the web.
What would be the best solution to have a few files that are only located on each development computer, and are never uploaded/committed, etc. I was thinking of throwing in an example file if anyone clones it down, that way they'd know how to create the real credentials file.
I'm pretty new to git, and so I don't think I have the experience to really come up with a good solution for this, so any help would be great.
Thanks,
Max
Your idea of committing an examples file and then not actually tracking the real file is a good one.
Just put the name of the real file in .gitignore so that no one will add it by accident.