Các kiểu được drupal 8 hỗ trợ: string, integer, map, filter_format, float, uri, boolean, datetime_computed, datetime_iso8601, any, language_reference, entity_reference, email, language.
Time between local and server timezone
strtotime('now') == time();
strtotime('12');
Show error messages in drupal 8
Same as drupal 7, we put this into sites/default/settings.php:
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
Undefined index: path
Notice: Undefined index: path in Drupal\Core\Routing\RouteBuilder->rebuild() (line 97 of core/lib/Drupal/Core/Routing/RouteBuilder.php
Cách fix: trong file routing.yml, thay pattern bằng path.
Install Sublime Text 3 on Ubuntu
- Install dev build: http://www.sublimetext.com/3dev
- cd ~/.config/sublime-text-3/Packages
- git clone git://github.com/wbond/sublime_package_control.git Package\ Control
- git clone https://github.com/martomo/SublimeTextXdebug.git "Xdebug Client"
- git clone -b BH2ST3 git://github.com/facelessuser/BracketHighlighter.git "BracketHighlighter"
- git clone https://github.com/spadgos/sublime-jsdocs
- git clone -b st3 git://github.com/titoBouzout/SideBarEnhancements.git "SideBarEnhancements"
- git clone https://github.com/sergeche/emmet-sublime.git Emmet
- git clone https://github.com/bgreenlee/sublime-github
- wget https://github.com/SublimeCodeIntel/SublimeCodeIntel/archive/v2.0.6+st3.tar.gz tar xfvz v2.0.6+st3.tar.gz -C ./ mv SublimeCodeIntel-2.0.6-st3 SublimeCodeIntel
- git clone https://github.com/dzhibas/SublimePrettyJson.git
- git clone https://github.com/srusskih/SublimeJEDI.git SublimeJEDI
- git clone https://github.com/akalongman/sublimetext-codeformatter
sudo pear install PHP_Beautifier-0.1.15 --alldeps
sudo vim /usr/bin/php_beautifier
# line 52
# error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
Refs: http://www.henriquebarroso.com/my-top-10sublime-2-plugins/
Bash for linux
- mv /.bashrc.bak.123456-789 .bashrc
- rm -rf abc/
update-alternatives --install "/usr/bin/drush" "drush" "/var/aegir/drush/drush" 2
update-alternatives --install "/usr/bin/drush" "drush" "/var/aegir/drush6/drush" 1
update-alternatives --config drush
Episode 5: Create new Platform, new Site
- ssh vào aegir.com
cd platforms
wget http://ftp.drupal.org/files/projects/drupal-6.28.tar.gz
wget http://ftp.drupal.org/files/projects/drupal-7.22.tar.gz
tar xfvz drupal\*.tar.gz
- để truy cập vào site ta mới tạo reset username và pass thành admin và admin sau khi tạo mới site.
Episode 2: Cài Aegir server
- Cài debian 6, lúc cài chọn root pass là root, thêm user name là aegir và password là aegir: adduser --system --group --home /var/aegir aegir passwd aegir usermod -a -G www-data aegir 
- Cài Aegir server. - a. wget http://files.aegir.cc/versions/BARRACUDA.sh.txtb. sau khi tải về ta thay đổi thông số của file BARRACUDA.sh.txt _MY_OWNIP="192.168.56.101" _MY_HOSTN="aegir.com" _MY_FRONT="master.aegir.com" _EASY_HOSTNAME="debian.com" _AUTOPILOT=YES _MY_EMAIL="webdev@aegir.com" _DNS_SETUP_TEST=NO nếu có gặp lỗi dns thì- nano /root/.barracuda.cnf_DNS_SETUP_TEST=NO c. nano /etc/hosts 192.168.56.101 aegir.com 192.168.56.101 master.aegir.com d. nano /etc/network/interface auto eth1 iface eth1 inet static address 192.168.56.101 network 192.168.56.0 netmask 255.255.255.0 # gateway 192.168.56.1 3. bạn nên thêm vào file /etc/hosts 2 dòng ở client: 192.168.56.101 aegir.com 192.168.56.101 master.aegir.com để client có thể truy cập vào admin.aegir.com để thay đổi pass và thực hiện cấu hình. ps: để đăng nhập và đổi pass ta làm như sau: cd ~ cat install.log dòng cuối cùng có chứa thông tin đăng nhập 1 lần để thay mật khẩu. hay có thể cd vào ~/host_master/001/sites/master.aegir drush uli để thay pass
- Sau khi cài xong, aegir cho ta một đường dẫn để reset password (nếu lỡ mất thì ta dùng lệnh drush uli). ta truy cập vào đường dẫn này từ 1 browser, reset username và pass lại thành admin và admin 
- chsh -s /bin/bash aegir passwd aegir su aegir ssh-keygen nano /etc/hosts 192.168.56.102 web.com 192.168.56.103 database.com 
- thêm webserver và database server. ssh-copy-id aegir@web.com ssh-copy-id root@web.com (rsync) ssh-copy-id aegir@database.com 
nguồn http://friendlydrupal.com/screencasts/installing-barracuda-aegir
Episode 3: Web server
ở đây có nói chi tiết về cách tạo web server cho aegir.http://community.aegirproject.org/node/396
- Chỉnh lại ip của web.com thành 192.168.56.102 
- passwd aegir 
- apt-get install sudo 
- Cài debian7 chọn hostname là web, username và pass là webdev 
- cài phần mêm trên web server (như ở trên) 
- nên chọn bash thay cho sh vì bash tốt hơn nhiều (cụ thể là cho xem user hiện tại, directory hiện tại, host hiện tại và có thể auto complete.) 
- không nên chạy dòng này - ln -s /var/aegir/config/apache.conf /etc/apache2/conf.d/aegir.confnếu chạy rồi thì xóa /etc/apache2/conf.d/aegir.conf đi
- dòng add key của debian.com nên thay bằng scp, thay 
cat > /var/aegir/.ssh/authorized_keys <<EOF
ssh-rsa AAAAB3NzaC1yc2EAAAADAQAB...UF aegir@filer01
EOF
bằng
scp /var/aegir/.ssh/id_rsa.pub aegir@web.com:~/.ssh/authorized_keys
hay
ssh-copy-id aegir@web.com
- nếu thấy lỗi Could not rsync from '/var/aegir/...' to 'aegir@web.com:/thì ở aegir.com ta đăng nhập vào aegir user, dùng lệnh ssh-copy-id aegir@web.com
- ở web server không tạo được platforms
- ln -s /var/aegir/config/apache.conf /etc/apache2/conf.d/aegir.conf service apache2 restart -Tim
wget http://ftp.drupal.org/files/projects/drush-7.x-5.9.tar.gz
tar xfvz drush\*.tar.gz
ln -s drush/drush /usr/bin/drush
cd platforms/drupal7/sites/all/modules
drush/drush dl ...
cd platforms/drupal7/sites/examples.com
~/drush/drush en ... -y
- nano /etc/apache2/httpd.conf ServerName localhost
nguồn:
Episode 4: Database server
- Cài debian 7 trong khi cài bạn chọn hostname là database có username là webdev và pass là webdev 
- cài xong khởi động lại bạn cài phần mềm mysql server: apt-get install mysql-server php5-mysql trong lúc cài bạn chọn pass cho user root là root 
- cấu hình 
- cho phép remote access ở database đi vào command line của mysql
mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO aegir@aegir.com IDENTIFIED BY 'aegir' WITH GRANT OPTION;
FLUSH PRIVILEGES;
- edit file my.cnf sudo cp /etc/mysql/my.cnf /etc/mysql/my.cnf.bak comment dòng bind-address = 127.0.0.1 _sudo /etc/init.d/mysql restart
- lúc tạo database server, bạn nhập vào username và pass là aegir (vì aegir từ aegir.com đã được full quyền trên database.com)_
tham khảo http://www.ghacks.net/2009/12/27/allow-remote-connections-to-your-mysql-server/
