RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby
environments from interpreters to sets of gems. To install Ubuntu in RVM 1. Check Apache and Mysql existed in your machine.
In /var/www/index.html type <?php phpinfo(); ?> , then type http://localhost or http://127.0.0.1 on your browser. If apache installation in your machine already correct, your browser will load PHP informations installed on your machine
source ~/.bash_profile .Note : This command is for reload opened terminal.
rvm requirements. Note : This command is for searching all libs that still needed, and then install the lib.
3. Install Ruby according to the version we need:
rvm install 1.9.3
4.Install another version of ruby with this method. 5. To view all installed RVM
rvm list
6.To use specifics RVM
rvm use 1.9.3
7.If there is an error when running rvm use 1.9.3 try open file ~/.bashrc and ~/.bash_profile and then add this script : [[
-s "$HOME/.rvm/scripts/rvm" ]] && source
"$HOME/.rvm/scripts/rvm" # Load RVM into a shell
session 8. To use Specifics Gemset
The MongoDB PHP driver should work on nearly any system: Windows, Mac OS X, Unix, and Linux; little- and big-endian machines; 32- and 64-bit machines; PHP 5.2, 5.3, 5.4 and 5.5. Install MongoDB Driver PHP
sudo pecl install mongo
Add extension=mongo.so in php.ini (/etc/php5/cli/php.ini)
Restart Apache: sudo service apache2 restart
Check Installed MongoDB
Check is MongoDB extensions already loaded in your PHP
php --ini already installed: /etc/php5/cli/conf.d/mongo.ini
Check is MongoDB extesions already enabled
php -i | grep 'Mongo'
Already Enabled: MongoDB Support => enabled
Java Runtime Enviroment also known as JRE is part of Java Development Kit JDK a software development environment for writing Java applications. JRE consist Java Virtual Machine, core classes, and supporting files.
Installing JRE on ubuntu is a little bit different with installation JDK. First, Download the JRE file in here. Remember to download JRE version based on your system version either it's 32bit or 64bit.
After finished downloading your JRE version, we can begin the installation process.
Create new folder in opt directory. In terminal type this command "sudo mkdir -p -v /opt/java/64".
Go to folder containing your JRE download file(example: use"cd Downloads" to move to Download directory from your home directory) and unpack the file by typing "tar xvzf YOUR JRE FILE".
Moved unpacked contents into system folder that you created in step1. Type "sudo mv -v YOUR JRE FILE /opt/java/64".
Inform the system and make the new JRE become your system default. - sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/64/YOUR EXTRACTED JRE FILE/bin/java" 1 - sudo update-alternatives --set java /opt/java/64/YOUR EXTRACTED JRE FILE/bin/java
Install Firefox plugins. Type "mkdir -v ~/.mozilla/plugins".
Removed IcedTea plugin, if it has been installed. type "sudo apt-get remove icedtea-6-plugin && sudo apt-get remove icedtea-7-plugin".
Remove an older version of the Java plugin. Type "rm -v ~/.mozilla/plugins/libnpjp2.so".
Install the plugin by creating symbolic link. Type "ln -s /opt/java/64/jre1.7.0_60/lib/amd64/libnpjp2.so ~/.mozilla/plugins/".
Close and restart Firefox
Type "about:plugins" in Firefox URL bar. If your installation is correct you will see something like this:
Veritrans is Indonesian Payment Gateway. Veritrans accepts Credit Card, Direct Debit, e-Wallet,Bank Transfer and Convenience Store. That's why this Payment Gateway is famous in Indonesia. Further explanations about Veritrans https://veritrans.co.id/ .
VT-Link facilitates a payment feature for your online store by redirecting the customer to Veritrans payment page through a link.
VT-Web
VT-Web facilitatess merchant to use Veritrans payment system, by redirecting the customer to the Veritrans payment page.
VT-Direct
VT-Direct is Veritrans product that allows you to use our payment system directly on your website
Integration Tool Kit
Rails 4
gem veritrans
Configurations
Add gem Veritrans to Gem File and bundle install
gem 'veritrans';
In Console generate veritrans.yml
rails g veritrans:install
Generate Veritrans Form
rails g veritrans:payment_form
This command will generate controller and view for Veritrans.
Because we will built dynamic key for this integrations. You can keep veritrans.yml configurations like this:
development:
# Register in sandbox veritrans and get your keys here:
# https://my.sandbox.veritrans.co.id/settings/config_info
client_key: ""
server_key: ""
api_host: ""
production:
# Register and get your keys here:
# https://my.veritrans.co.id/settings/config_info
client_key: ""
server_key: ""
api_host: ""
staging:
# Register and get your keys here:
# https://my.veritrans.co.id/settings/config_info
client_key: ""
server_key: ""
api_host: ""
Scripting
VT-Web Integrations
In VT-Web Integrations, you just need to obtain redirect URL to Veritrans . After last check out process, put this function for directing page to veritrans:
Rubycritic is gem that wraps around static analysis gems such as Reek, Flay and Flog to provide a quality report of your Ruby code.
Because this gem was uses as Audit guidelines code quality in my company, I often faced hard time to adjust, optimizing and refactor my code.
I began to summarize Rubycritic detecting behavior and implement it in my code to avoid Smells and easier get at least Grade C to bare pass.
A few my conclusion things to consider when developing code according Rubycritic :
Don't! Never! Avoid! Duplicity Code. Rubycritic love this think and will give you sudden great high score, enough to drop your Code Rating Grade.
Evade complicated nested logic with multiple if, switch, etc. It's saver to use functions to handle logic rather than nested logic. Fox example
// Rather than this
if obj == "a"
if obj1 == "1" && obj2 == "2"
// Process
elsif obj1 == "3" && obj2 == "4"
// Process
else
// Process
end
elsif obj1 == "b"
if obj1 == "1" && obj2 == "2"
// Process
elsif obj1 == "3" && obj2 == "4"
// Process
else
// Process
end
else
// Process
end
// Use this
if obj == "a"
process(obj1,obj2)
elsif obj1 == "b"
process(obj1,obj2)
else
// Process
end
Evade complicated nested loops with multiple each, for, etc. It's saver to use functions to handle loops rather than nested loops. Fox example
// Rather than this
data_sources.each do |data_source|
data_source.each do |data|
end
end
// Use This
data_sources.each do |data_source|
process(data_source)
end
If your function using nested hash, redeclare multiple used nested hash using variable.
// rather than
if params[:id] == '1'
user = User.where('id = ?',params[:id])
end
// Used This
id = params[:id]
if id == '1'
user = User.where('id = ?',id)
end
To build Test Plan in Jmeter Apache. We need several step to configuring the process.
Right click in Test Plan > Add > Thread Group
Customize the Thread Group with your desire configurations like number of threads(User),The Ramp-Up Period, and loop count. - Number of threads : Number of Users -The Ramp-Up Period : This property tells JMeter how long to delay between starting each user. For example, if you enter a Ramp-Up Period of 5 seconds, JMeter will finish starting all of your users by the end of the 5 seconds. So, if we have 5 users and a 5 second Ramp-Up Period, then the delay between starting users would be 1 second (5 users / 5 seconds = 1 user per second). If you set the value to 0, then JMeter will immediately start all of your users. - Loop Count : This property tells JMeter how many times to repeat your test
Right click in Thread Group created before and go to > Add > Config Element > HTTP Request
Name-- the name of this HTTP request. The name should be descriptive; remember that it is common to have multiple HTTP Request elements in a thread group.
Server Name or IP-- the server name or the IP address of the machine running the application being tested.
Port Number-- the port number used by the application. Normally, a Web application runs on port 80.
Protocol-- the protocol used, either HTTP or HTTPS.
Method-- the request method, either GET or POST.
Path-- the path to the resource that will handle this request.
Parameters-- the list of parameters sent with this request. Use the Add and Delete buttons to add and remove parameters.
Send a file with a request-- simulate a file upload to the Web application.
Retrieve all images and Java Applets-- download embedded content.
Right click in Thread Group created before and go to > Add > Listener > View Result Tree.
Right click in Thread Group created before and go to > Add > Listener > Summary Report. Explanations:
Label:Recorded HTTP requests. Samples:Samples denote to the number of http request ran for given thread. Average: Average is the average response time for that particular http request. This response time is in millisecond. Min:Min denotes to the minimum response time taken by the http request. Max:Max denotes to the maximum response time taken by the http request.
Std.Deviation:This shows how many exceptional cases were found which were deviating from the average value of the receiving time. The lesser this value more consistent the time pattern is assumed.
Error %: This denotes the error percentage in samples during run. This error can be of 404(file not found), or may be exception or any kind of error during test run will be shown in Error %. In the above image the error % is zero, because all the requests ran successfully.
Apache JMeteris a 100% pure Java desktop application designed to load test client/server software (such as aweb application). It may be used to test performance both on static and dynamic resources such as static files, Java Servlets, CGI scripts, Java objects,databases,FTP servers, and more. JMeter can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types.
Jmeter can do stress test to client/server application such as simultaneously massive user login and process. Jmeter works in protocol level and using Java desktop applications.
Start Jmeter Installation :
Go to terminal and check your Java version by typing "java -version". It will give result something like this depending on your Java version. java version "1.7.0_60" Java(TM) SE Runtime Environment (build 1.7.0_60-b19) Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)If nothing displays, please re-Install Java SE runtime environment
We can make customize box from our vagrant existed box. With this, we can change our environment in existing box and customize it according our need.
Scripting
// In your Vagrant Init file directory
vagrant up
// Get in to your vagrant environment
vagrant ssh
/*
* Do your custumize in here
* For example. I will remove my existing ruby version from vagrant box and change it to new one
*/
sudo apt-get update -y
sudo apt-get install build-essential zlib1g-dev libssl-dev libreadline-dev \
git-core curl libyaml-dev libcurl4-dev libsqlite3-dev apache2-dev -y
curl --remote-name http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar zxf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure
make
sudo make install
// Check if my new ruby version successfully installed
ruby -v
// If succeed quit from vagrant ssh
exit
// Adding your customize box to new box
vagrant package
// Name it
vagrant box add lucid64_with_ruby193 package.box
// Check for your new box
vagrant box list
- lucid32
- lucid64
- lucid64_with_ruby193
// Activate your vagrant
vagrant init lucid64_with_ruby193
Breakman is static analysis security scanner for Ruby on Rails. It's open source vulnerability scanner specifically designed for Ruby on Rails applications. It statically analyzes Rails application code to find security issues at any stage of development. I will share some trick to avoid Breakman Mass Assignment medium settings warning.
Pay attention to your model relationship. My suggestion always use Nested Attributes .
If necessary used attr_protected to relationship variable key in your model.
Below is some of example case I've solved:
Example Case 1 "Without Relationship" :
Set relationship variable in attr_protected to avoid Breakman warning.
Dispatcher is a Laravel artisan command scheduling tool used to schedule artisan commands within your project so you don't need to touch your crontab when deploying.
For Futher Information go to this link Dispatcher.
Do you hate to touch crontab to add scheduller in laravel?
Do you hate with all crontab configuration when add scheduller in different servers?
Congratulations, Laravel has package to handle this problem using Dispatcher. Everthing become simple and easy with this package. Doubt? Here we go!
In your application add this to your "require" :{} composer.json
"indatus/dispatcher": "1.4.*@dev"
remember to do composer update.
In your app/config/app.php providers array add this line:
'Indatus\Dispatcher\ServiceProvider',
Usage
scheduled
scheduled:make Create a new scheduled artisan command
scheduled:run Run scheduled commands
scheduled:summary View a summary of all scheduled artisan commands
Build scheduled command
php artisan scheduled:make yourCommands
Register scheduled command
In Your app/start/artisan.php add this line depend on Your Command :
Artisan::add(new yourCommands);
Scripting
Go to your command app/command/yourCommands and change
// my artisan command will be php artisan cron:mycommands
protected $name = 'cron:yourCommands';
// Configure this functions to change schedule time
public function schedule(Schedulable $scheduler)
{
// Change this function to change time
return $scheduler->daily();
}
This is Scheduler Changes time function example list:
//every day at 4:17am
return $scheduler->daily()->hours(4)->minutes(17);
//every Monday/Friday at 8:30am
return $scheduler->daysOfTheWeek([
Scheduler::MONDAY,
Scheduler::FRIDAY
])->hours(8)->minutes(30);
// Using Raw Commands
//every other day at 1:59am, 13:59pm and 23:59pm
return $scheduler->setSchedule(59, [1,13,23], '*/2', '*', '*');
// Every minutes
return $scheduler->everyMinutes();
// Every 20 minutes
return $scheduler->everyMinutes(10);
// Every hours
return $scheduler->everyHours();
Cron Setup
In console add
crontab -e
* * * * * php {{ path to your app}}/artisan scheduled:run 1>> /dev/null 2>&1
Debugging
If your cron not running check this
// Via console, check your mcrypt
php -i | mcrypt.
// Via console
php artisan scheduled:run --debug
backup:avatars: No schedules were due
command:name: No schedules were due
myTestCommand:name: No schedules were due
cache:clean: /usr/bin/env php /Users/myUser/myApp/artisan cache:clean > /dev/null &
mail:subscribers: /usr/bin/env php /Users/myUser/myApp/artisan mail:subscribers > /dev/null &
// Via Console
php artisan scheduled:summary
//It works if output something like this:
+----------------+------------------+-----------+--------+------+--------------+-------+-------------+--------+
| Environment(s) | Name | Args/Opts | Minute | Hour | Day of Month | Month | Day of Week | Run as |
+----------------+------------------+-----------+--------+------+--------------+-------+-------------+--------+
| * | schedule:test | | */5 | * | * | * | * | |
+----------------+------------------+-----------+--------+------+--------------+-------+-------------+--------+
Queue is great tools in laravel for implementing delayed job. Queue allowing system to put task in background so it can become faster and make users skip waiting until tasks is finished.
Queue can be implemented to handle big process such as generating reports, image processing, sending email, or even heavy CRUD process.
Queue::push() command can be use in Route, Controller, or even Command.
Running Queue
To running Queue we need Beanstalk as a worker. To activate beanstalk running this command in console
// To fire last job
php artisan queue:work
// To fire running job and listen it
php artisan queue:listen
// add listener with flag (you can choose or implement all of this)
php artisan queue:work --timeout=0 --queue="default" --delay=0 --memory=128 --sleep=3 --tries=0
Install and Configure Beanstalk
Install Beanstalk
sudo apt-get update
// Install in Debian or ubuntu
sudo apt-get install beanstalkd
Configure Beanstalk
sudo nano /etc/default/beanstalkd
// Add or uncomment this line
START yes
Start Beanstalk
sudo service beanstalkd start
Configure Beanstalk in Our Laravel App
Set default queue in app to Beanstalk. Go to app/config/queue.php
We use php artisan queue:work or php artisan queue:work as listener, but we know that impossible for us to running this command every time we push job to Queue or when we start servers.
To overcome this we use Supervisor to listen all of active worker. Supervisor will listen all of our queue:work --daemon and restart it if failed.
sudo supervisorctl
reread # Tell supervisord to check for new items in /etc/supervisor/conf.d/
add reportqueue # Add reportqueue process to Supervisord
start reportqueue # Let's Rock
Check Supervisor
// In Console
ps aux | grep php
# You should see some output similarish this:
php artisan queue:work --daemon --env=your_environment
sh -c php artisan queue:work --queue="default" --delay=0 --memory=128 --sleep --env=your_environment
php artisan queue:work --queue=default --delay=0 --memory=128 --sleep --env=your_environment
LinkedIn OAuth 2.0 is Rails Gems to integrate Linked Social Media to our Apps through API. This Gem is easy to integrated and use, we can directly GET and POST data from Linkedin. But, theres a problem when using add_share API using https://github.com/emorikawa/linkedin-oauth2 documentations. api.add_share(content:"hi")will always generated error. I've search, read Linkedin documentation, and customize the library but it always generated error. After a few times I found that doing a little change in add_share comments it will works. Changes the command into: api.add_share(comment:"hi") Voila, it works... :D
Koala is a Facebook library for Ruby, supporting the Graph API (including the batch requests and photo uploads), the REST API, realtime updates, test users, and OAuth validation.
Installation
In Gemfile:
gem "koala", "~> 2.0"
gem 'oauth', '~> 0.4.7'
Never forget to bundle install
Build Callback URL route:
get '/facebook_callback' => 'facebook#callback', as: :facebook_callback
Facebook Configurations
Get App ID and Secret Key:
Go to https://developers.facebook.com/
In My Apps, add or go to your New App
Get your App ID and App secret
App Configurations
In config/environments/{{your-environments}} add this line
This process will built redirect function to permission page user account in Facebook and return with App Token and App Token Secret. Facebook doesn't recognize localhost with port, if we want to built this connectivity it's better to do it in staging or live servers. Only to get Token and Secret Token Code.
// Connect
facebook_connect = Koala::Facebook::OAuth.new({{your-app-id}},{{your-secret-id}}, {{callback URL}})
// This function will automatically redirecting user to Facebook permission page and redirect it back to your Callback URL
redirect_to facebook_connect.url_for_oauth_code(:permissions => ["publish_actions", "user_posts"])
// Get Token Accces Code
code = facebook.get_access_token(params[:code])
// Get Token Access Secret Code
app_code = facebook.get_app_access_token
// Sample of Get my profile from Facebook
client = Koala::Facebook::API.new(code, {{your -secret-key}})
me = client.get_object("me")
// Save code and app_code to database. This tokens needed for REST API Process
Codeigniter 3 has released in March,30 2015. It's available to download in here.
There's a a lot of huge changes from Codeigniter Version 2 to Codeigniter Version 3. Here is some of the changes I take from Codeigniter sites.
License
CodeIgniter has been relicensed with the MIT License, eliminating its old proprietary licensing.
General Changes
PHP 5.1.6 is no longer supported. CodeIgniter now requires PHP 5.2.4 and recommends PHP 5.4+ or newer to be used.
Changed filenaming convention (class file names now must be Ucfirst and everything else in lowercase).
Changed the default database driver to ‘mysqli’ (the old ‘mysql’ driver is DEPRECATED).
$_SERVER['CI_ENV'] can now be set to control the ENVIRONMENT constant.
Added an optional backtrace to php-error template.
Added Android to the list of user agents.
Added Windows 7, Windows 8, Windows 8.1, Android, Blackberry, iOS and PlayStation 3 to the list of user platforms.
Added Fennec (Firefox for mobile) to the list of mobile user agents.
Ability to log certain error types, not all under a threshold.
Added support for pem, p10, p12, p7a, p7c, p7m, p7r, p7s, crt, crl, der, kdb, rsa, cer, sst, csr Certs to mimes.php.
Added support for pgp, gpg, zsh and cdr files to mimes.php.
Added support for 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
Added support for m4a, aac, m4u, xspf, au, ac3, flac, ogg, wma Audio files to mimes.php.
Added support for kmz and kml (Google Earth) files to mimes.php.
Added support for ics Calendar files to mimes.php.
Added support for rar, jar and 7zip archives to mimes.php.
Updated support for xml (‘application/xml’) and xsl (‘application/xml’, ‘text/xsl’) files in mimes.php.
Updated support for doc files in mimes.php.
Updated support for docx files in mimes.php.
Updated support for php files in mimes.php.
Updated support for zip files in mimes.php.
Updated support for csv files in mimes.php.
Added Romanian, Greek, Vietnamese and Cyrilic characters in application/config/foreign_characters.php.
Changed logger to only chmod when file is first created.
Removed previously deprecated SHA1 Library.
Removed previously deprecated use of $autoload['core'] in application/config/autoload.php. Only entries in$autoload['libraries'] are auto-loaded now.
Removed previously deprecated EXT constant.
Updated all classes to be written in PHP 5 style, with visibility declarations and no var usage for properties.
Added an Exception handler.
Moved error templates to application/views/errors/ and made the path configurable via $config['error_views_path'].
Added support non-HTML error templates for CLI applications.
Moved the Log class to application/core/
Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment.
Changed detection of $view_folder so that if it’s not found in the current path, it will now also be searched for under the application folder.
Path constants BASEPATH, APPPATH and VIEWPATH are now (internally) defined as absolute paths.
Updated email validation methods to use filter_var() instead of PCRE.
Changed environment defaults to report all errors in development and only fatal ones in testing, production but only display them in development.
Updated ip_address database field lengths from 16 to 45 for supporting IPv6 address on Trackback Library and Captcha Helper.
Removed cheatsheets and quick_reference PDFs from the documentation.
Added availability checks where usage of dangerous functions like eval() and exec() is required.
Added support for changing the file extension of log files using $config['log_file_extension'].
Added support for turning newline standardization on/off via $config['standardize_newlines'] and set it to FALSE by default.
Added configuration setting $config['composer_autoload'] to enable loading of a Composer auto-loader.
Removed the automatic conversion of ‘programmatic characters’ to HTML entities from the URI Library.
Changed log messages that say a class or file was loaded to “info” level instead of “debug”, so that they don’t pollute log files when $config['log_threshold'] is set to 2 (debug).
Added an optional third parameter to force_download() that enables/disables sending the actual file MIME type in the Content-Type header (disabled by default).
Added a work-around in force_download() for a bug Android <= 2.1, where the filename extension needs to be in uppercase.
Added support for reading from an existing file path by passing NULL as the second parameter to force_download()(useful for large files and/or safely transmitting binary data).
Deprecated the Email Helper as its valid_email(), send_email() functions are now only aliases for PHP native functionsfilter_var() and mail() respectively.
Database
DEPRECATED the ‘mysql’, ‘sqlite’, ‘mssql’ and ‘pdo/dblib’ (also known as ‘pdo/mssql’ or ‘pdo/sybase’) drivers.
Added dsn configuration setting for drivers that support DSN strings (PDO, PostgreSQL, Oracle, ODBC, CUBRID).
Added schema configuration setting (defaults to public) for drivers that might need it (currently used by PostgreSQL and ODBC).
Added save_queries configuration setting to application/config/database.php (defaults to TRUE).
Removed autoinit configuration setting as it doesn’t make sense to instantiate the database class but not connect to the database.
Added subdrivers support (currently only used by PDO).
Added an optional database name parameter to db_select().
Removed protect_identifiers() and renamed internal method _protect_identifiers() to it instead - it was just an alias.
Renamed internal method _escape_identifiers() to escape_identifiers().
Updated escape_identifiers() to accept an array of fields as well as strings.
MySQL and MySQLi drivers now require at least MySQL version 5.1.
Added a $persistent parameter to db_connect() and changed db_pconnect() to be an alias for db_connect(TRUE).
db_set_charset() now only requires one parameter (collation was only needed due to legacy support for MySQL versions prior to 5.1).
db_select() will now always (if required by the driver) be called by db_connect() instead of only when initializing.
Replaced the _error_message() and _error_number() methods with error(), which returns an array containing the last database error code and message.
Improved version() implementation so that drivers that have a native function to get the version number don’t have to be defined in the core DB_driver class.
Added capability for packages to hold config/database.php config files.
Added MySQL client compression support.
Added encrypted connections support (for mysql, sqlsrv and PDO with sqlsrv).
Removed Loader Class from Database error tracing to better find the likely culprit.
Added support for SQLite3 database driver.
Added Interbase/Firebird database support via the ibase driver.
Added ODBC support for create_database(), drop_database() and drop_table() in Database Forge.
Added support to binding arrays as IN() sets in query().
Renamed the Active Record class to Query Builder to remove confusion with the Active Record design pattern.
Added the ability to insert objects with insert_batch().
Added new methods that return the SQL string of queries without executing them: get_compiled_select(),get_compiled_insert(), get_compiled_update(), get_compiled_delete().
Added an optional parameter that allows to disable escaping (useful for custom fields) for methods join(),order_by(), where_in(), or_where_in(), where_not_in(), or_where_not_in(), insert(), insert_batch().
Added support for join() with multiple conditions.
Added support for USING in join().
Added support for EXISTS in where().
Added seed values support for random ordering with order_by(seed,'RANDOM').
Changed limit() to ignore NULL values instead of always casting to integer.
Changed offset() to ignore empty values instead of always casting to integer.
Methods insert_batch() and update_batch() now return an integer representing the number of rows affected by them.
Methods where(), or_where(), having() and or_having() now convert trailing = and <>, != SQL operators toISNULL and ISNOTNULL respectively when the supplied comparison value is NULL.
Added method chaining support to reset_query(), start_cache(), stop_cache() and flush_cache().
Added an optional second parameter to count_all_results() to disable resetting of QB values.
Added a constructor to the DB_result class and moved all driver-specific properties and logic out of the baseDB_driver class to allow better abstraction.
Added method unbuffered_row() for fetching a row without prefetching the whole result (consume less memory).
Renamed former method _data_seek() to data_seek() and made it public.
Improved support for the MySQLi driver, including:
OOP style usage of the PHP extension is now used, instead of the procedural aliases.
Server version checking is now done via mysqli::$server_info instead of running an SQL query.
Added persistent connections support for PHP >= 5.3.
Added support for configuring socket pipe connections.
Added support for passing a custom database object to the loader.
Modified the class to no longer extend Database Forge, which has been a deprecated behavior for awhile.
Overall improved support for all of the drivers.
Added foreign_key_checks option to MySQL/MySQLi backup, allowing statement to disable/re-enable foreign key checks to be inserted into the backup output.
The initialize() method now only sets existing class properties.
Added support for 3-length hex color values for wm_font_color and wm_shadow_color properties, as well as validation for them.
Class properties wm_font_color, wm_shadow_color and wm_use_drop_shadow are now protected, to avoid breaking thetext_watermark() method if they are set manually after initialization.
If property maintain_ratio is set to TRUE, image_reproportion() now doesn’t need both width and height to be specified.
Property maintain_ratio is now taken into account when resizing images using ImageMagick library.
Added support for maintaining transparency for PNG images when watermarking.
Added method error_array() to return all error messages as an array.
Added method set_data() to set an alternative data array to be validated instead of the default $_POST.
Added method reset_validation() which resets internal validation variables in case of multiple validation routines.
Added support for setting error delimiters in the config file via $config['error_prefix'] and $config['error_suffix'].
Internal method _execute() now considers input data to be invalid if a specified rule is not found.
Removed method is_numeric() as it exists as a native PHP function and _execute() will find and use that (theis_numeric rule itself is deprecated since 1.6.1).
Native PHP functions used as rules can now accept an additional parameter, other than the data itself.
Updated method set_rules() to accept an array of rules as well as a string.
Fields that have empty rules set no longer run through validation (and therefore are not considered erroneous).
Added rule differs to check if the value of a field differs from the value of another field.
Added rule valid_url.
Added rule in_list to check if the value of a field is within a given list.
Added support for named parameters in error messages.
Language line keys must now be prefixed with form_validation_.
Added rule alpha_numeric_spaces.
Added support for custom error messages per field rule.
Added support for callable rules when they are passed as an array.
Added support for non-ASCII domains in valid_email rule, depending on the Intl extension.
Changed the debug message about an error message not being set to include the rule name it is about.
Added a custom filename parameter to attach() as $this->email->attach($filename,$disposition,$newname).
Added possibility to send attachment as buffer string in attach() as$this->email->attach($buffer,$disposition,$newname,$mime).
Added possibility to attach remote files by passing a URL.
Added method attachment_cid() to enable embedding inline attachments into HTML.
Added dsn (delivery status notification) option.
Renamed method _set_header() to set_header() and made it public to enable adding custom headers.
Successfully sent emails will automatically clear the parameters.
Added a return_path parameter to the from() method.
Removed the second parameter (character limit) from internal method _prep_quoted_printable() as it is never used.
Internal method _prep_quoted_printable() will now utilize the native quoted_printable_encode(), imap_8bit()functions (if available) when CRLF is set to “rn”.
Default charset now relies on the global $config['charset'] setting.
Removed unused protected method _get_ip() (Input Library‘s ip_address() should be used anyway).
Internal method _prep_q_encoding() now utilizes PHP’s mbstring and iconv extensions (when available) and no longer has a second ($from) argument.
Added an optional parameter to print_debugger() to allow specifying which parts of the message should be printed (‘headers’, ‘subject’, ‘body’).
Added SMTP keepalive option to avoid opening the connection for each send() call. Accessible as $smtp_keepalive.
Public method set_header() now filters the input by removing all “\r” and “\n” characters.
Added support for non-ASCII domains in valid_email(), depending on the Intl extension.
Deprecated the $config['global_xss_filtering'] setting.
Added method() to retrieve $_SERVER['REQUEST_METHOD'].
Added support for arrays and network addresses (e.g. 192.168.1.1/24) for use with the proxy_ips setting.
Added method input_stream() to aid in using php://input stream data such as one passed via PUT, DELETE and PATCH requests.
Changed method valid_ip() to use PHP’s native filter_var() function.
Changed internal method _sanitize_globals() to skip enforcing reversal of register_globals in PHP 5.4+, where this functionality no longer exists.
Changed methods get(), post(), get_post(), cookie(), server(), user_agent() to return NULL instead of FALSE when no value is found.
Changed default value of the $xss_clean parameter to NULL for all methods that utilize it, the default value is now determined by the $config['global_xss_filtering'] setting.
Added method post_get() and changed get_post() to search in GET data first. Both methods’ names now properly match their GET/POST data search priorities.
Changed method _fetch_from_array() to parse array notation in field name.
Changed method _fetch_from_array() to allow retrieving multiple fields at once.
Added an option for _clean_input_keys() to return FALSE instead of terminating the whole script.
Deprecated the is_cli_request() method, it is now an alias for the new is_cli() common function.
Added an $xss_clean parameter to method user_agent() and removed the $user_agent property.
Added property $raw_input_stream to access php://input data.
Changed site_url() method to accept an array as well.
Removed internal method _assign_to_config() and moved its implementation to CodeIgniter.php instead.
item() now returns NULL instead of FALSE when the required config item doesn’t exist.
Added an optional second parameter to both base_url() and site_url() that allows enforcing of a protocol different than the one in the base_url configuration setting.
Added HTTP “Host” header character validation to prevent cache poisoning attacks when base_url auto-detection is used.