14.2.6.2 Forcing InnoDB Recovery

14.2.6.2 Forcing InnoDB Recovery If there is database page corruption, you may want to dump your tables from the database with SELECT ... INTO OUTFILE. Usually, most of the data obtained in this way is intact. However, it is possible that the corruption might cause SELECT * FROM tbl_name statements or InnoDB background operations to crash or assert, or even cause InnoDB roll-forward recovery to crash. In such cases, you can use the innodb_force_recovery option to force the InnoDB storage engine to start up while preventing background operations from running, so that you are able to dump your tables. For example, you can add the following line to the [mysqld] section of your option file before restarting the server: [mysqld] innodb_force_recovery = 1 Warning Only set

Drupal installed in subdirectory but made to appear in root

In order to keep all the Drupal files together, I wanted to install it into the ~pageroot/drupal/ subdirectory of my web server, but I didn't want to have to access it via http://www.mysite.com/drupal/ -- I wanted to access it as if it lived in the root, at http://www.mysite.com/. Here's my solution: In the root, I placed an .htaccess file that contained: Options -Indexes RewriteEngine on Options +FollowSymLinks RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC] RewriteRule .* http://www.mysite.com/ [L,R=301] RewriteRule ^$ drupal/index.php [L] RewriteCond %{DOCUMENT_ROOT}/drupal%{REQUEST_URI} -f RewriteRule .* drupal/$0 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* drupal/index.php?q=$0 [QSA] Then in dru...

Best approach to model validation in PHP

Best approach to model validation in PHP I've learned that there are often many ways to solve one programming problem, each approach typically having its own benefits and negative side affects. What I'm trying to determine today is the best way to do model validation in PHP. Using the example of a person, I've outlined four different approaches I've used in the past, each including the classes and a usage example, as well as what I like and dislike about each approach. My question here is this: Which approach do you feel is best? Or do you have a better approach? Approach #1: Validation using setter methods in model class The good Simple, only one class By throwing exceptions, the class can never be in an invalid state (except for business logic, ie. de...