eZ Publish is not the fastest CMS I’ve seen. It is flexible (you can define your own classes (type of content), and the fields that define your class. But it seems like « more flexible != fast ». Just take a look at the number of queries on a page that has object relations fields, and you will understand why: it can reach more than 100 queries on a page!
If your eZ Publish is slow (actually even if it’s not slow!!), you should activate eZ Publish caching mechanism. I was looking for some info about eZ Publish, and here is what I found.
Links and notes about Ez Publish caching
- http://share.ez.no/articles/ez-publish/ez-publish-performance-optimization-part-3-of-3-practical-cache-and-template-solutions/%28page%29/2
- This article explains the different cache mechanism (template cache, view cache, preview cache), and the {cache-block} template function
- http://ez.no/doc/ez_publish/technical_manual/4_x/features/view_caching/configuring_the_view_cache
deactivate eZ Publish cache on ou development environment
These are the settings I usually add to the frontend siteaccesses to deactivate the cache mechanism. Remember to remov them on your staging/test and live environments.
[ContentSettings]
#...(other settings in that section)
#dev only
ViewCaching=disabled
#dev only
PreViewCache=disabled
[TemplateSettings]
#... (other settings in that section)
#dev only
TemplateCache=enabled
[OverrideSettings]
#... (other settings in that section)
#dev only
Cache=disabled
Oh, and also deactivate template caching (in TemplateSettings), your integrators will hate you if you don’t: they would have to clear eZ Publish cache everytime they change a template – using the following command:
php bin/php/ezcache --clear-all --purge
Because I don’t want to loose time with those things the next time I setup MAMP, I decided to write it down. I hope it will help you too!
mod_rewrite doesn’t work?
Make sure mod_rewrite is enabled:
LoadModule rewrite_module modules/mod_rewrite.so
Check you httpd.conf (or apache.conf) settings, specially the following setting: AllowOverride
AllowOverride All
You can put inside a Directory block, in a virtual host for example:
<VirtualHost *:8888>
ServerName local.mysite.com
DocumentRoot /path/to/web/root
<Directory "/path/to/web/root">
AllowOverride All
</Directory>
#...
This is valid for any Apache bundle (MAMP, WAMP, XAMP, or Apache itself)
MAMP mySQL – connection problem?
If you’re having trouble connecting to MySQL (using PDO for example), try the following tip:
edit startMySQL.sh in /Applications/MAMP/bin and add the following line at the end:
ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock &
Pour tous ceux qui comme moi ne comprenaient pas pourquoi le « sync » de symfony gelait sur leur Windows, avec cygwin, voici l’astuce du jour (trouvé sur le trac de symfony):
Ajouter la ligne suivante dans votre properties.ini (par environnement):
[prod]
host=www.mywebproject.com
port=22
user=USERNAME
dir=/home/path/to/project/on/prod/
parameters="-azvC --force --delete --exclude-from=config/rsync_exclude.txt"
PS.1: j’avais trouvé une autre astuce qui nécessitait de modifier le fichier de la tache projectDeploy de Symfony (en ajoutant un « exec »), mais cette méthode est bien plus propre, merci!
PS.2: j’ai ajouté l’option « v » (=verbose) afin que rsync liste les fichiers qui sont affecté par la synchronisation. C’est à vous de voir!
PS.3: Il m’arrive de devoir changer les permissions des fichiers sur production (plus qu’un simple « symfony project:permissions »), donc histoire à suivre…
PS.4: Suite de l’histoire: Idiot, cygwin utilise les permissions à-la-Unix, il suffisait de mettre les bonnes permissions avec cygwin…
Suite à l’article précédent sur mes problèmes pour créer un widget permettant de sélectionner un ami facebook sur un site facebook connect, j’ai finalement créer un plugin jquery.
Vous pouvez downloader le plugin sur github.com.
Des infos (sommaires pour l’instant) sont disponibles ici. J’espère que vous allez apprécier!
J’ai fait une traduction rapide du thème « life is simple » en français (fr_FR) mais certainement plus fr_CA…
Vous pouvez le télécharger ici.
À utiliser/modifier selon vos besoins!!
Ah oui, j’ai utilisé poedit pour créer les fichiers de traductions.
To create the file
sudo htpasswd -c .htpassword.CLIENT.PROJECT USERNAME
To add users to it
sudo htpasswd .thenameofthefile USERNAME2
to configure a website (vhost) to use that file
<Directory "/var/www/staging/PATH/TO/CLIENT/PROJECT/web">
Options -Indexes
AuthName "TD Staging Server"
AuthType Basic
AuthUserFile /var/www/staging/td/.htpassword.CLIENT.PROJECT
Require valid-user
AllowOverride All
Allow from All
</Directory>
Howto get the user object in a form
Solution to get to user object in an sfForm object: use the 2nd $option parameter while creating the form object and retrieve it.
// In your actions.class.php
$this->form = new myForm(array(), array("currentUser" => $this->getUser()));
// In your form class
// ...
if (!is_object($this->getOption("currentUser")) || !($this->getOption("currentUser") instanceof sfUser))
{
throw new InvalidArgumentException("You must pass a user object as an option to this form!);
}
Source: http://eatmymonkeydust.com/2009/08/symfony-forms-flexible-widgets-based-on-user-credentials/
Voici quelques notes en vue de jouer avec la geolocalisation, et quelques API « géolocalisées ».
Flickr:
http://www.flickr.com/services/api/flickr.photos.search.html
- Nécessite une API key
- recherche par tags possible, donc possible de rechercher foursquare:venue=XXXX
- Limite de requêtes (par jour/heures/??): ???
OAuth:
GeoIP:
- sur un shared hosting, le plus simple: http://pear.php.net/package/Net_GeoIP/
- À la limite, downloader pour customiser (car les require_once me semblent problématiques – warnings!!)
- DB free:
- Autres solutions:
Foursquare API:
Lastfm:
Google Maps
- essayer un plugin jquery:
Mise à jour:
Voici une première version alpha d’un site qui utilise la geolocalisation… http://geo.fruitsoftware.com . Vos commentaires sont les bienvenus sur cet article.
- page: X
- nb_per_page: Y
- => OFFSET = (X-1)*Y
- =>OFFSET = (page-1)*nb_per_page
Easy, no?