GNS3 file transfer to or from appliance in VM

Read More

The method described uses WinSCP

  • Install SCP client if needed
  • Identify GNS3 VM url
  • You get the url, file path and user at VM opening

  • Open SCP connection to GNS3 VM
  • User: gns3 Password: gns3

  • Navigate to identify instance of appliance in /root/..
  • It is easy to identify the project files with the date of last modification. In this specific case, we are going to get a downloaded file from a router through Webterm (a docker containing Firefox that can be added to GNS3). You get the id of the instance of the object inside the project hovering over it in GNS3. The file is downloaded in a folder of the docker.

  • Modify permissions
  • Open docker file handler to modify permissions of root folder

QR for fast WiFi access

Download a QR generator program: Download QR Code Studio
Optionally, you can use an online service to generate the QR at your own risk.
Feed this text adapted to your needs:

WIFI:S:My_SSID;T:WPA;P:key goes here;H:false;

Code type
ESSID
encryption type
WPA key
hidden SSID (true/false)

If needed, escape any special characters (“, ‘, ;, ,, or \) with a backslash

Using touch command

Read More

touch Creates a file without content

touch file_name

For multiple files

touch File_name1 File2_name2 File_name3

Running touch on an already existing file: the file’s access and modification timestamps are updated to the current time, the content is not modified

touch -a To modify the access time only

touch -a file_name

touch -am Change access and modification time together

touch -am file_name

touch -c To check if file is created or not

touch -c file_name

-d option Use string with date instead of current time
touch -c -d "2020-03-09 11:33:12.000000000 +0100" file_name
-t option Use timestamp instead of current time. Format [[CC]YY]MMDDhhmm[.ss] touch -c -t 202003091133 file_name

touch -m This is used to change the modification time only
touch -m file_name

touch -r This command is used to copy only the timestamp onto another file

touch -r reference_file_name target_file_name

touch -h For modifying a symbolic link, not the pointed to

touch -h symbolic_link_file

Create several files touch

# Create files with names A to Z
$ touch {A..Z}
# Create files with names 1 to 20
$ touch {1..20}
# Create files with extension
$ touch {1..1000}.txt
# Create 10K files
$ touch {1..10}{1..1000}

Using touch to restore timestamps in a directory tree

To change all the directories to 755 (drwxr-xr-x):

find /opt/lampp/htdocs -type d -exec chmod 755 {} \;

To change all the files to 644 (-rw-r–r–):

find /opt/lampp/htdocs -type f -exec chmod 644 {} \;

And to change file and directories timestamp

find . -exec touch {} \;

Only files

find . -type f -exec touch {} \;

Mount a deviceless webdav connection in Windows 10

Mount deviceless webdav
This type of connection cannot be persistent
net use http://domain/directory/ paasword /USER:user
Access
It is necessary to use MS \\server\resource notation
dir \\domain\directory
Mount with first unallocated unit letter
net use * http://domain/directory/ paasword /USER:user
Mount with specific drive
net use x: http://domain/directory/ paasword /USER:user
Unmount

net use http://domain/directory/ /delete
net use x: /delete

Caution:
net use * /delete
deletes all connections

Net Use Command Options
Option Explanation
net use Execute the net use command alone to show detailed information about currently mapped drives and devices.
devicename Use this option to specify the drive letter or printer port you want to map the network resource to. For a shared folder on the network, specify a drive letter from D: through Z:, and for a shared printer, LPT1: through LPT3:. Use * instead of specifying devicename to automatically assign the next available drive letter, starting with Z: and moving backward, for a mapped drive.
\\computername\sharename This specifies the name of the computer, computername, and the shared resource, sharename, like a shared folder or a shared printer connected to computername. If there are spaces anywhere here, be sure to put the entire path, slashes included, in quotes.
volume Use this option to specify the volume when connecting to a NetWare server.
password This is the password needed to access the shared resource on computername. You can choose to enter the password during the execution of the net use command by typing * instead of the actual password.
/user Use this net command option to specify a username to connect to the resource with. If you don’t use /user, net use will attempt to connect to the network share or printer with your current username.
domainname Specify a different domain than the one you’re on, assuming you’re on one, with this option. Skip domainname if you’re not on a domain or you want net use to use the one you’re already on.
username Use this option with /user to specify the username to use to connect to the shared resource.
dotteddomainname This option specifies the fully qualified domain name where username exists.
/home This net use command option maps the current user’s home directory to either the devicename drive letter or the next available drive letter with *.
/persistent:{yes | no} Use this option to control the persistence of connections created with the net use command. Choose yes to automatically restore created connections at the next login or choose no to limit the life of this connection to this session. You can shorten this switch to /p if you like.
/smartcard This switch tells the net use command to use the credentials present on the available smart card.
/savecred This option stores the password and user information for use next time you connect in this session or in all future sessions when used with /persistent:yes.
/delete This net use command is used to cancel a network connection. Use /delete with devicename to remove a specified connection or with * to remove all mapped drives and devices. This option can be shortened to /d.
/help Use this option, or the shortened /h, to display detailed help information for the net use command. Using this switch is the same as using the net help command with net use: net help use.
/? The standard help switch also works with the net use command but only displays the command syntax, not any detailed information about the command’s options.

Run Powershell script Windows 10

Read More

Create Script

Search for Windows PowerShell ISE and run the integrated editor.
Click on File menu.
Select the New option to create a new empty .ps1 file

Verify execution Policy

Run powershell as administrator.
Set-ExecutionPolicy RemoteSigned
On Windows 10, PowerShell includes four execution policies, including:

  • Restricted — Stops any script from running.
  • RemoteSigned — Runs scripts created on the device. However, scripts created on another computer won’t run unless they include a signature of a trusted publisher.
  • AllSigned — All the scripts will run as long as they’ve been signed by a trusted publisher.
  • Unrestricted — Runs any script without any restrictions.

Execute script

Execute command
& "C:\PATH\TO\SCRIPT\name_of_script.ps1"

Add Command Prompt As Administrator Context Menu in Windows 10

Read More

Create .reg file and execute with content:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenElevatedCmd] @="Open command prompt here as administrator"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOT\Directory\shell\OpenElevatedCmd\command] @="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenElevatedCmd] @="Open command prompt here as administrator"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\OpenElevatedCmd\command] @="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""
[HKEY_CLASSES_ROOT\Drive\shell\OpenElevatedCmd] @="Open command prompt here as administrator"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOT\Drive\shell\OpenElevatedCmd\command] @="PowerShell -windowstyle hidden -Command \"Start-Process cmd.exe -ArgumentList '/s,/k,pushd,%V' -Verb RunAs\""
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenElevatedCmd] @="Open command prompt here as administrator"
"Icon"="cmd.exe"
[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenElevatedCmd\command] @=

Of tyrannies

Read More

“Of all tyrannies, a tyranny sincerely exercised for the good of its victims may be the most oppressive. It would be better to live under robber barons than under omnipotent moral busybodies. The robber baron’s cruelty may sometimes sleep, his cupidity may at some point be satiated; but those who torment us for our own good will torment us without end for they do so with the approval of their own conscience.” – C.S. Lewis

Magento 1.x Events Reference

The following is a list of many Magento Community Edition events with module and parameters.

Note that some events are dispatched with dynamically-calculated names, so this list is and always will be “incomplete”.

At the bottom there is example of using an event.

Magento Module Event Name Parameters
Mage Admin admin_session_user_login_success array(’user’⇒$user)
Mage Admin admin_session_user_login_failed array(’user_name’⇒$username, ‘exception’ ⇒ $e)
Mage Admin admin_user_authenticate_after array(’username’ ⇒ $username,’password’ ⇒ $password,’user’ ⇒ $this,’result’ ⇒ $result)
Mage Adminhtml adminhtml_block_html_before array(’block’ ⇒ $this)
Mage Adminhtml adminhtml_catalog_category_tabs array(’tabs’ ⇒ $this)
Mage Adminhtml adminhtml_catalog_category_tree_is_moveable array(’options’⇒$options)
Mage Adminhtml adminhtml_catalog_category_tree_can_add_root_category array(’category’ ⇒ $this→getCategory(),’options’ ⇒ $options,’store’ ⇒ $this→getStore()→getId())
Mage Adminhtml adminhtml_catalog_category_tree_can_add_sub_category array(’category’ ⇒ $this→getCategory(),’options’ ⇒ $options,’store’ ⇒ $this→getStore()→getId())
Mage Adminhtml adminhtml_product_attribute_types array(’response’⇒$response)
Mage Adminhtml adminhtml_catalog_product_edit_prepare_form array(’form’⇒$form)
Mage Adminhtml adminhtml_catalog_product_edit_element_types array(’response’⇒$response)
Mage Adminhtml adminhtml_catalog_product_attribute_set_main_html_before array(’block’ ⇒ $this)
Mage Adminhtml adminhtml_catalog_product_attribute_set_toolbar_main_html_before array(’block’ ⇒ $this)
Mage Adminhtml adminhtml_catalog_product_form_prepare_excluded_field_list array(’object’⇒$this)
Mage Adminhtml adminhtml_catalog_product_edit_prepare_form array(’form’⇒$form)
Mage Adminhtml adminhtml_catalog_product_edit_element_types array(’response’⇒$response)
Mage Adminhtml adminhtml_catalog_product_edit_tab_attributes_create_html_before array(’block’ ⇒ $this)
Mage Adminhtml adminhtml_cms_page_edit_tab_content_prepare_form array(’form’ ⇒ $form)
Mage Adminhtml adminhtml_cms_page_edit_tab_design_prepare_form array(’form’ ⇒ $form)
Mage Adminhtml adminhtml_cms_page_edit_tab_main_prepare_form array(’form’ ⇒ $form)
Mage Adminhtml adminhtml_cms_page_edit_tab_meta_prepare_form array(’form’ ⇒ $form)
Mage Adminhtml adminhtml_widget_grid_filter_collection array(’collection’ ⇒ $this→getCollection(), ‘filter_values’ ⇒ $this→_filterValues)
Mage Adminhtml adminhtml_widget_container_html_before array(’block’ ⇒ $this)
Mage Adminhtml adminhtml_controller_action_predispatch_start array()
Mage Adminhtml adminhtml_customer_prepare_save array(’customer’ ⇒ $customer, ‘request’ ⇒ $this→getRequest())
Mage Adminhtml adminhtml_customer_save_after array(’customer’ ⇒ $customer)
Mage Adminhtml on_view_report array(’report’ ⇒ ‘search’)
Mage Adminhtml catalog_category_prepare_save array(’category’ ⇒ $category,’request’ ⇒ $this→getRequest())
Mage Adminhtml catalog_controller_category_delete array(’category’⇒$category)
Mage Adminhtml catalog_product_new_action array(’product’ ⇒ $product)
Mage Adminhtml catalog_product_edit_action array(’product’ ⇒ $product)
Mage Adminhtml catalog_product_prepare_save array(’product’ ⇒ $product, ‘request’ ⇒ $this→getRequest())
Mage Adminhtml catalog_controller_product_delete array(’product’ ⇒ $product)
Mage Adminhtml catalog_product_to_website_change array(
Mage Adminhtml cms_page_prepare_save array(’page’ ⇒ $model, ‘request’ ⇒ $this→getRequest())
Mage Adminhtml adminhtml_cmspage_on_delete array(’title’ ⇒ $title, ‘status’ ⇒ ‘success’)
Mage Adminhtml adminhtml_cmspage_on_delete array(’title’ ⇒ $title, ‘status’ ⇒ ‘fail’)
Mage Adminhtml admin_permissions_role_prepare_save array(’object’ ⇒ $role, ‘request’ ⇒ $this→getRequest())
Mage Adminhtml adminhtml_controller_catalogrule_prepare_save array(’request’ ⇒ $this→getRequest())
Mage Adminhtml adminhtml_controller_salesrule_prepare_save array(’request’ ⇒ $this→getRequest())
Mage Adminhtml adminhtml_sales_order_create_process_data $eventData
Mage Adminhtml adminhtml_sales_order_creditmemo_register_before $args
Mage Adminhtml admin_system_config_changed_section_{$section} array(’website’ ⇒ $website, ‘store’ ⇒ $store)
Mage Adminhtml store_group_save array(’group’ ⇒ $groupModel)
Mage Adminhtml store_edit array(’store’⇒$storeModel)
Mage Adminhtml store_add array(’store’⇒$storeModel)
Mage Adminhtml store_delete array(’store’ ⇒ $model)
Mage Adminhtml sales_convert_order_to_quote array(’order’ ⇒ $order,’quote’ ⇒ $this→getQuote())
Mage Adminhtml sales_convert_order_item_to_quote_item array(’order_item’ ⇒ $orderItem,’quote_item’ ⇒ $item)
Mage Api api_user_authenticated array(’model’ ⇒ $this,’api_key’ ⇒ $apiKey)
Mage Bundle bundle_product_view_config $args
Mage Bundle prepare_catalog_product_index_select array(’select’ ⇒ $select,’entity_field’ ⇒ new Zend_Db_Expr(’e.entity_id’),’website_field’ ⇒ new Zend_Db_Expr(’cw.website_id’),’store_field’ ⇒ new Zend_Db_Expr(’cs.store_id’))
Mage Bundle prepare_catalog_product_price_index_table array(’index_table’ ⇒ array(’i’ ⇒ $this→_getDefaultFinalPriceTable()),’select’ ⇒ $select,’entity_id’ ⇒ ‘i.entity_id
Mage Bundle catalog_product_prepare_index_select array(’website’ ⇒ $website,’select’ ⇒ $select)
Mage Bundle catalog_product_get_final_price array(’product’⇒$product)
Mage Catalog catalog_block_product_list_collection array(’collection’⇒$this→_getProductCollection(),)
Mage Catalog catalog_product_view_config array(’response_object’⇒$responseObject)
Mage Catalog catalog_product_upsell array(’product’ ⇒ $product,’collection’ ⇒ $this→_itemCollection,’limit’ ⇒ $this→getItemLimit())
Mage Catalog catalog_controller_category_init_before array(’controller_action’⇒$this)
Mage Catalog catalog_controller_category_init_after array(’category’⇒$category, ‘controller_action’⇒$this)
Mage Catalog catalog_controller_product_init_before array(’controller_action’⇒$this)
Mage Catalog catalog_controller_product_init array(’product’⇒$product)
Mage Catalog catalog_controller_product_init_after array(’product’⇒$product, ‘controller_action’ ⇒ $this)
Mage Catalog catalog_controller_product_view array(’product’⇒$product)
Mage Catalog catalog_product_compare_add_product array(’product’⇒$product)
Mage Catalog catalog_product_compare_remove_product array(’product’⇒$item)
Mage Catalog catalog_helper_output_construct array(’helper’⇒$this)
Mage Catalog catalog_category_tree_move_before $eventParams
Mage Catalog $this→_eventPrefix.’_move_before’ $eventParams
Mage Catalog $this→_eventPrefix.’_move_after’ $eventParams
Mage Catalog catalog_category_tree_move_after $eventParams
Mage Catalog category_move $eventParams
Mage Catalog $this→_eventPrefix.’_validate_before’ array($this→_eventObject⇒$this)
Mage Catalog $this→_eventPrefix.’_validate_after’ array($this→_eventObject⇒$this)
Mage Catalog catalog_model_product_duplicate array(’current_product’⇒$this, ‘new_product’⇒$newProduct)
Mage Catalog catalog_product_is_salable_before array(’product’ ⇒ $this)
Mage Catalog catalog_product_is_salable_after array(’product’ ⇒ $this,’salable’ ⇒ $object)
Mage Catalog $this→_eventPrefix.’_delete_after_done’ array($this→_eventObject⇒$this)
Mage Catalog catalog_product_import_after array()
Mage Catalog catalog_product_website_update_before array(’website_ids’ ⇒ $websiteIds,’product_ids’ ⇒ $productIds,’action’ ⇒ $type)
Mage Catalog catalog_product_website_update array(’website_ids’ ⇒ $websiteIds,’product_ids’ ⇒ $productIds,’action’ ⇒ $type)
Mage Catalog catalog_product_status_update array(’product_id’ ⇒ $productId,’store_id’ ⇒ $storeId,’status’ ⇒ $value)
Mage Catalog catalog_product_get_final_price array(’product’⇒$product)
Mage Catalog catalog_category_change_products array(’category’ ⇒ $category,’product_ids’ ⇒ $productIds)
Mage Catalog $this→_eventPrefix . ‘_load_before’ array($this→_eventObject ⇒ $this)
Mage Catalog $this→_eventPrefix . ‘_load_after’ array($this→_eventObject ⇒ $this)
Mage Catalog $this→_eventPrefix . ‘_add_is_active_filter’ array($this→_eventObject ⇒ $this)
Mage Catalog catalog_category_tree_init_inactive_category_ids array(’tree’⇒$this)
Mage Catalog catalog_category_tree_init_inactive_category_ids array(’tree’⇒$this)
Mage Catalog catalog_category_tree_move_before array(’category’ ⇒ $category,’prev_parent’ ⇒ $prevNode,’parent’ ⇒ $newParent)
Mage Catalog catalog_category_tree_move_after array(’category’ ⇒ $category,’prev_node’ ⇒ $prevNode,’parent’ ⇒ $newParent)
Mage Catalog $this→_eventPrefix . ‘_load_before’ array($this→_eventObject ⇒ $this)
Mage Catalog $this→_eventPrefix . ‘_load_after’ array($this→_eventObject ⇒ $this)
Mage Catalog $this→_eventPrefix . ‘_add_is_active_filter’ array($this→_eventObject ⇒ $this)
Mage Catalog catalogindex_prepare_price_select $eventArgs
Mage Catalog catalog_prepare_price_select $eventArgs
Mage Catalog catalog_product_collection_load_before array(’collection’⇒$this)
Mage Catalog catalog_product_collection_load_after array(’collection’⇒$this)
Mage Catalog catalog_product_collection_before_add_count_to_categories array(’collection’⇒$this)
Mage Catalog catalog_product_collection_apply_limitations_after array(’collection’ ⇒ $this)
Mage Catalog catalog_product_compare_item_collection_clear’
Mage Catalog catalog_product_flat_prepare_columns array(’columns’ ⇒ $columnsObject)
Mage Catalog catalog_product_flat_prepare_indexes array(’indexes’ ⇒ $indexesObject)
Mage Catalog catalog_product_flat_rebuild array(’store_id’ ⇒ $store,’table’ ⇒ $this→getFlatTableName($store))
Mage Catalog catalog_product_flat_update_product array(’store_id’ ⇒ $store,’table’ ⇒ $this→getFlatTableName($store),’product_ids’ ⇒ $productIds)
Mage Catalog prepare_catalog_product_index_select array(’select’ ⇒ $select,’entity_field’ ⇒ new Zend_Db_Expr(’pid.entity_id’),’website_field’ ⇒ new Zend_Db_Expr(’cs.website_id’),’store_field’ ⇒ new Zend_Db_Expr(’cs.store_id’))
Mage Catalog prepare_catalog_product_index_select array(’select’ ⇒ $select,’entity_field’ ⇒ new Zend_Db_Expr(’pvd.entity_id’),’website_field’ ⇒ new Zend_Db_Expr(’cs.website_id’),’store_field’ ⇒ new Zend_Db_Expr(’cs.store_id’))
Mage Catalog prepare_catalog_product_index_select array(’select’ ⇒ $select,’entity_field’ ⇒ new Zend_Db_Expr(’l.parent_id’),’website_field’ ⇒ new Zend_Db_Expr(’cs.website_id’),’store_field’ ⇒ new Zend_Db_Expr(’cs.store_id’))
Mage Catalog prepare_catalog_product_index_select array(’select’ ⇒ $select,’entity_field’ ⇒ new Zend_Db_Expr(’e.entity_id’),’website_field’ ⇒ new Zend_Db_Expr(’cw.website_id’),’store_field’ ⇒ new Zend_Db_Expr(’cs.store_id’))
Mage Catalog prepare_catalog_product_price_index_table array(’index_table’ ⇒ array(’i’ ⇒ $this→_getDefaultFinalPriceTable()),’select’ ⇒ $select,’entity_id’ ⇒ ‘i.entity_id
Mage Catalog prepare_catalog_product_price_index_select array(’select’ ⇒ $select,’entity_field’ ⇒ new Zend_Db_Expr(’e.entity_id’),’website_field’ ⇒ new Zend_Db_Expr(’cw.website_id’),’store_field’ ⇒ new Zend_Db_Expr(’cs.store_id’))
Mage CatalogIndex catalogindex_plain_reindex_after array(’products’ ⇒ $products)
Mage CatalogIndex catalogindex_prepare_price_select $args
Mage CatalogIndex catalogindex_get_minimal_price $eventData
Mage CatalogIndex catalogindex_prepare_price_select $args
Mage CatalogIndex catalogindex_prepare_price_select $args
Mage CatalogIndex catalogindex_prepare_price_select $args
Mage CatalogIndex catalogindex_prepare_price_select $args
Mage CatalogRule catalogrule_before_apply array(’resource’⇒$this)
Mage CatalogRule catalogrule_after_apply array(’product’⇒$product,’product_condition’ ⇒ $productCondition)
Mage CatalogSearch catalogsearch_reset_search_result’
Mage Checkout checkout_cart_add_product_complete array(’product’ ⇒ $product, ‘request’ ⇒ $this→getRequest(), ‘response’ ⇒ $this→getResponse())
Mage Checkout checkout_controller_multishipping_shipping_post array(’request’⇒$this→getRequest(), ‘quote’⇒$this→_getCheckout()→getQuote())
Mage Checkout checkout_multishipping_controller_success_action’
Mage Checkout checkout_onepage_controller_success_action’
Mage Checkout checkout_controller_onepage_save_shipping_method array(’request’⇒$this→getRequest(), ‘quote’⇒$this→getOnepage()→getQuote())
Mage Checkout checkout_allow_guest array(’quote’ ⇒ $quote,’store’ ⇒ $store,’result’ ⇒ $result)
Mage Checkout checkout_cart_product_add_after array(’quote_item’⇒$result, ‘product’⇒$product)
Mage Checkout checkout_cart_update_items_before array(’cart’⇒$this, ‘info’⇒$data)
Mage Checkout checkout_cart_update_items_after array(’cart’⇒$this, ‘info’⇒$data)
Mage Checkout checkout_cart_info_item_unset_product_before array(
Mage Checkout checkout_quote_init array(’quote’⇒$quote)
Mage Checkout checkout_quote_destroy array(’quote’⇒$this→getQuote())
Mage Checkout checkout_type_multishipping_set_shipping_items array(’quote’⇒$this→getQuote())
Mage Checkout checkout_type_multishipping_create_orders_single array(’order’⇒$order, ‘address’⇒$address)
Mage Checkout checkout_type_onepage_save_order array(’order’⇒$order, ‘quote’⇒$this→getQuote())
Mage Checkout checkout_type_onepage_save_order_after array(’order’⇒$order, ‘quote’⇒$this→getQuote())
Mage Cms cms_controller_router_match_before array(’router’ ⇒ $this,’condition’ ⇒ $condition)
Mage Cms cms_page_get_available_statuses array(’statuses’ ⇒ $statuses)
Mage Core core_block_abstract_prepare_layout_before array(’block’ ⇒ $this)
Mage Core core_block_abstract_prepare_layout_after array(’block’ ⇒ $this)
Mage Core core_block_abstract_to_html_before array(’block’ ⇒ $this)
Mage Core core_block_abstract_to_html_after array(’block’ ⇒ $this)
Mage Core http_response_send_before array(’response’⇒$this)
Mage Core controller_action_layout_load_before array(’action’⇒$this, ‘layout’⇒$this→getLayout())
Mage Core controller_action_layout_generate_xml_before array(’action’⇒$this, ‘layout’⇒$this→getLayout())
Mage Core controller_action_layout_generate_blocks_before array(’action’⇒$this, ‘layout’⇒$this→getLayout())
Mage Core controller_action_layout_generate_blocks_after array(’action’⇒$this, ‘layout’⇒$this→getLayout())
Mage Core controller_action_layout_render_before’
Mage Core controller_action_layout_render_before_’.$this→getFullActionName()
Mage Core controller_action_predispatch array(’controller_action’⇒$this)
Mage Core controller_action_predispatch_’.$this→getRequest()→getRouteName() array(’controller_action’⇒$this)
Mage Core controller_action_predispatch_’.$this→getFullActionName() array(’controller_action’⇒$this)
Mage Core controller_action_postdispatch_’.$this→getFullActionName() array(’controller_action’⇒$this)
Mage Core controller_action_postdispatch_’.$this→getRequest()→getRouteName() array(’controller_action’⇒$this)
Mage Core controller_action_postdispatch array(’controller_action’⇒$this)
Mage Core controller_action_noroute array(’action’⇒$this, ‘status’⇒$status)
Mage Core controller_action_nocookies array(’action’ ⇒ $this,’redirect’ ⇒ $redirect)
Mage Core controller_front_init_before array(’front’⇒$this)
Mage Core controller_front_init_routers array(’front’⇒$this)
Mage Core model_load_after array(’object’⇒$this)
Mage Core $this→_eventPrefix.’_load_after’ array($this→_eventObject⇒$this)
Mage Core model_save_commit_after array(’object’⇒$this)
Mage Core $this→_eventPrefix.’_save_commit_after’ array($this→_eventObject⇒$this)
Mage Core model_save_before array(’object’⇒$this)
Mage Core $this→_eventPrefix.’_save_before’ array($this→_eventObject⇒$this)
Mage Core model_save_after array(’object’⇒$this)
Mage Core $this→_eventPrefix.’_save_after’ array($this→_eventObject⇒$this)
Mage Core model_delete_before array(’object’⇒$this)
Mage Core $this→_eventPrefix.’_delete_before’ array($this→_eventObject⇒$this)
Mage Core model_delete_after array(’object’⇒$this)
Mage Core $this→_eventPrefix.’_delete_after’ array($this→_eventObject⇒$this)
Mage Core model_delete_commit_after array(’object’⇒$this)
Mage Core $this→_eventPrefix.’_delete_commit_after’ array($this→_eventObject⇒$this)
Mage Core application_clean_cache array(’tags’ ⇒ $tags)
Mage Core core_locale_set_locale array(’locale’⇒$this)
Mage Core resource_get_tablename array(’resource’ ⇒ $this, ‘model_entity’ ⇒ $modelEntity, ‘table_name’ ⇒ $tableName)
Mage Core core_layout_update_updates_get_after array(’updates’ ⇒ $updatesRoot)
Mage Core core_layout_update_updates_get_after array(’updates’ ⇒ $updatesRoot)
Mage Core core_collection_abstract_load_before array(’collection’ ⇒ $this)
Mage Core core_collection_abstract_load_after array(’collection’ ⇒ $this)
Mage Customer customer_registration_is_allowed array(’result’ ⇒ $result)
Mage Customer customer_customer_authenticated array(’model’ ⇒ $this,’password’ ⇒ $password,)
Mage Customer customer_session_init array(’customer_session’⇒$this)
Mage Customer customer_login array(’customer’⇒$customer)
Mage Customer customer_login array(’customer’⇒$customer)
Mage Customer customer_login array(’customer’⇒$customer)
Mage Customer customer_logout array(’customer’ ⇒ $this→getCustomer())
Mage Eav adminhtml_block_eav_attribute_edit_form_init array(’form’ ⇒ $this→getForm())
Mage Eav eav_attribute_get_backend_type_by_input array(’model’⇒$this, ‘type’⇒$type)
Mage Eav eav_attribute_get_default_value_by_input array(’model’⇒$this, ‘type’⇒$type)
Mage Eav eav_collection_abstract_load_before array(’collection’ ⇒ $this)
Mage GoogleCheckout google_checkout_discount_item_price array(’quote’ ⇒ $this→getQuote(), ‘discount_item’ ⇒ $discountItem)
Mage Log log_log_clean_before array(’log’ ⇒ $object)
Mage Log log_log_clean_after array(’log’ ⇒ $object)
Mage Log log_visitor_collection_load_before array(’collection’ ⇒ $this)
Mage Oscommerce store_add array(’store’⇒$storeModel)
Mage Payment payment_method_is_active array(’result’ ⇒ $checkResult,’method_instance’ ⇒ $this,’quote’ ⇒ $quote,)
Mage Paypal checkout_type_onepage_save_order array(’order’⇒$order, ‘quote’⇒$this→getReview()→getQuote())
Mage Paypal checkout_type_onepage_save_order array(’order’⇒$order, ‘quote’⇒$this→getQuote())
Mage PaypalUk checkout_type_onepage_save_order array(’order’⇒$order, ‘quote’⇒$this→getReview()→getQuote())
Mage PaypalUk checkout_type_onepage_save_order array(’order’⇒$order, ‘quote’⇒$this→getQuote())
Mage Review review_controller_product_init_before array(’controller_action’⇒$this)
Mage Review review_controller_product_init array(’product’⇒$product)
Mage Review review_controller_product_init_after array(’product’⇒$product, ‘controller_action’ ⇒ $this)
Mage Review review_review_collection_load_before array(’collection’ ⇒ $this)
Mage Rss rss_catalog_category_xml_callback $args
Mage Rss rss_catalog_new_xml_callback $args
Mage Rss rss_catalog_special_xml_callback $args
Mage Rss rss_catalog_tagged_item_xml_callback $args
Mage Rss rss_order_new_collection_select array(’collection’ ⇒ $collection)
Mage Rule rule_environment_collect array(’env’⇒$this)
Mage Sales sales_order_place_before array(’order’⇒$this)
Mage Sales sales_order_place_after array(’order’⇒$this)
Mage Sales sales_quote_remove_item array(’quote_item’ ⇒ $item)
Mage Sales sales_quote_add_item array(’quote_item’ ⇒ $item)
Mage Sales $this→_eventPrefix . ‘_collect_totals_before’ array($this→_eventObject⇒$this)
Mage Sales $this→_eventPrefix . ‘_collect_totals_after’ array($this→_eventObject⇒$this)
Mage Sales $this→_eventPrefix . ‘_merge_before’ array($this→_eventObject⇒$this,’source’⇒$quote)
Mage Sales $this→_eventPrefix . ‘_merge_after’ array($this→_eventObject⇒$this,’source’⇒$quote)
Mage Sales sales_convert_order_to_quote array(’order’⇒$order, ‘quote’⇒$quote)
Mage Sales sales_convert_quote_to_order array(’order’⇒$order, ‘quote’⇒$quote)
Mage Sales sales_convert_quote_address_to_order array(’address’⇒$address, ‘order’⇒$order)
Mage Sales sales_convert_quote_address_to_order_address array(’address’ ⇒ $address, ‘order_address’ ⇒ $orderAddress)
Mage Sales sales_convert_quote_payment_to_order_payment array(’order_payment’ ⇒ $orderPayment, ‘quote_payment’ ⇒ $payment)
Mage Sales sales_convert_quote_item_to_order_item array(’order_item’⇒$orderItem, ‘item’⇒$item)
Mage Sales sales_quote_item_collection_products_after_load array(’product_collection’⇒$productCollection)
Mage Sales sales_sale_collection_query_before array(’collection’ ⇒ $this)
Mage Sales sales_order_creditmemo_refund array($this→_eventObject⇒$this)
Mage Sales sales_order_creditmemo_cancel array($this→_eventObject⇒$this)
Mage Sales sales_order_invoice_pay array($this→_eventObject⇒$this)
Mage Sales sales_order_invoice_cancel array($this→_eventObject⇒$this)
Mage Sales sales_order_item_cancel array(’item’⇒$this)
Mage Sales sales_order_payment_place_start array(’payment’ ⇒ $this)
Mage Sales sales_order_payment_place_end array(’payment’ ⇒ $this)
Mage Sales sales_order_payment_capture array(’payment’ ⇒ $this, ‘invoice’ ⇒ $invoice)
Mage Sales sales_order_payment_pay array(’payment’ ⇒ $this, ‘invoice’ ⇒ $invoice)
Mage Sales sales_order_payment_cancel_invoice array(’payment’ ⇒ $this, ‘invoice’ ⇒ $invoice)
Mage Sales sales_order_payment_void array(’payment’ ⇒ $this, ‘invoice’ ⇒ $document)
Mage Sales sales_order_payment_refund array(’payment’ ⇒ $this, ‘creditmemo’ ⇒ $creditmemo)
Mage Sales sales_order_payment_cancel_creditmemo array(’payment’ ⇒ $this, ‘creditmemo’ ⇒ $creditmemo)
Mage Sales sales_order_payment_cancel array(’payment’ ⇒ $this)
Mage Sales sales_quote_item_qty_set_after array(’item’⇒$this)
Mage Sales sales_quote_item_set_product array(’product’ ⇒ $product,’quote_item’⇒$this)
Mage Sales $this→_eventPrefix . ‘_import_data_before’ array($this→_eventObject⇒$this,’input’⇒$data,)
Mage Sales sales_quote_address_discount_item $eventArgs
Mage Sales sales_quote_address_discount_item $eventArgs
Mage SalesRule salesrule_validator_process array(’rule’ ⇒ $rule,’item’ ⇒ $item,’address’ ⇒ $address,’quote’ ⇒ $quote,’qty’ ⇒ $qty,’result’ ⇒ $result,)
Mage SalesRule sales_quote_address_discount_item $eventArgs
Mage SalesRule sales_quote_address_discount_item $eventArgs
Mage SalesRule salesrule_rule_condition_combine array(’additional’ ⇒ $additional)
Mage Sendfriend sendfriend_product array(’product’ ⇒ $product)
Mage Tag tag_tag_product_collection_load_after array(’collection’ ⇒ $this)
Mage Tax tax_rate_data_fetch array(’request’⇒$this)
Mage Tax tax_settings_change_after’
Mage Tax tax_settings_change_after’
Mage Tax tax_settings_change_after’
Mage Tax tax_settings_change_after’
Mage Tax tax_settings_change_after’
Mage Wishlist wishlist_add_product array(’wishlist’⇒$wishlist, ‘product’⇒$product)
Mage Wishlist wishlist_share array(’wishlist’⇒$wishlist)

This is what should be put in config.xml of your module to hook on an event.

Original post

 

Magento 1.X getUrl() Function Parameters

Read More

In many, many places throughout Magento you will come across uses of getUrl() that generates a web address. It takes just two parameters but is immensely versatile.

Parameter 1 – $routePath

The route path follows the Zend behaviour of “module/controller/action”.

The module part is self-explanatory. For example “cms” resolves to Mage_Cms.

The controller is the class that will handle the address. “cms/page” refers to the class Mage_Cms_PageController.

Lastly, the action is the method within that class. “cms/page/view” will callMage_Cms_PageController::viewAction().

If any of these parts is given as “*” it will use the current module, controller or action in use. If omitted it defaults to “index”. For example; If viewing a CMS page then the following is equivalent to “cms/page/index”. Note there is no “view”.

  1. Mage::getUrl(‘*/*’);

Parts that aren’t recognised are passed verbatim which makes for an easy shortcut. You can pass the path to a static file and it will be appended to the domain.

  1. Mage::getUrl(‘index.html’);

Parameter 2 – $routeParams

This is an array that converts key/values into pairs of path directories.

  1. Mage::getUrl(‘cms/page/view’array(‘id’ => 1));

There are several special values that effect the outcome. They all begin with an underscore and are reserved.

_absolute n/a No effect. URLs are always generated as absolute.
_current bool Uses the current module, controller, action and parameters
_direct string Simply append to the base URL, same effect as passing to $routePath. See _store
_escape bool Uses & instead of &
_forced_secure bool Uses the secure domain given in configuration
_fragment string The last part of the URL after a #
_ignore_category bool Only applies to Mage_Catalog_Model_Product_Url::getUrl(). Prevents category rewrite from being used.
_nosid bool Prevents a SID query parameter being used when referencing another store
_query string or array If an array it is converted into a string like ?key=value&key=value which will become the$_GET variable.
_secure bool Uses the secure domain if allowed in configuration
_store int or string Either the numeric store ID or textual store code. It will use the correct domain as the base URL.
_store_to_url bool Adds ___store to the query parameters. Useful for targetting a store that doesn’t have an unique domain.
_type string link is the default. direct_link is useful for bypassing the “store code in URLs” feature. js,media and skin append the domain (and possibly store code) with the relevant directory.
_use_rewrite bool Looks up the module/controller/action/parameters in the database for a search engine friendly equivalent.

Usage Examples

Current Page

  1. Mage::getUrl(array(
  2.     ‘_current’ => true,
  3.     ‘_use_rewrite’ => true
  4. ));

Full path is preserved. Fragment and queries are stripped.

Current Page, Secured, For Another Store

  1. Mage::getUrl(array(
  2.     ‘_current’ => true,
  3.     ‘_use_rewrite’ => true,
  4.     ‘_secure’ => true,
  5.     ‘_store’ => 2,
  6.     ‘_store_to_url’ => true
  7. ));

Session ID may well be added automatically to solve the cookie problem.

Static Page On Main Store

  1. Mage::getUrl(‘example.html’array(
  2.     ‘_nosid’ => true,
  3.     ‘_store’ => ‘default’,
  4.     ‘_type’ => ‘direct_link’
  5. ));

Session ID is stripped, the static will not be using it. A type of direct_link means a store code is not inserted

Original post

User management in Ubuntu

Show last user logins into the system
lastlog | less
Currently logged in users in the system
who

Add new user
adduser username usergroupname (perl calling useradd)
useradd username

Delete user
userdel username
userdel -r username removing home directory

deluser with /etc/deluser.conf (Debian and derivatives)
deluser --remove-home