Single Line
- if [ $BITBUCKET_BRANCH == 'master' ]; then
- echo "We are on master"
- fi
Multi Line
- >
if [ $BITBUCKET_BRANCH == 'master' ]; then
echo "We are on master :)"
else
echo "We are not on master :("
fi
not just another WordPress site
- if [ $BITBUCKET_BRANCH == 'master' ]; then
- echo "We are on master"
- fi
- >
if [ $BITBUCKET_BRANCH == 'master' ]; then
echo "We are on master :)"
else
echo "We are not on master :("
fi
Recently, I’ve bought horses — three of them. Wildfire is 20 years old, a grade horse, and about as sweet and gentle as you could imagine a horse being. Henderson is 11, an OTTB, and Mina is 8, also an OTTB.
Next month, I’m moving into a ranch house with a barn, where I’ll get to live with these guys. Right now, they are stabled at a barn near my current house.
I’m excited, and terrified.
Trying to remove a block from a layout and it won’t go away? A trick to figure out where you are working is to use $block->getNameInLayout() and that should tell you what block you need to remove.
Did you create a module, does it load after or before a core module that might be putting your block back in? Did you set the core module as a dependency in both composer.json and module.xml in your module? If not, add that in, and setup:upgrade module:disable your module and setup:upgrade module:enable your module to force the dependency order to get reset.
Find the Ubuntu App in the Windows App Store and install it.
Run the bash shell – click the app icon to run it. You will be logged in to your Ubuntu machine.
Now, you need apache, mysql, and phpmyadmin, at a bare minimum in order to start your localhost web server. You probably also want to use multiple versions of php since you will have different web sites with different production environments.
Ubuntu will give you php 7.0 by default. We will add 5.6, 7.1, and 7.2 also.
$ sudo apt-get install apache2 libapache2-mod-fcgid
You will be prompted to type Y to complete the installation.
$ sudo service apache2 start
if you are prompted for a password, this is your password for the windows user account you are using windows under presently. You may see an error message when you start the service that looks like the below. You can safely ignore this message.
At this point, you should be able to find your localhost in a browser.
$ sudo apt-get install mysql-server
Again, you will be prompted to type Y to complete the installation
$ sudo service mysql start
$ mysql -u root -p
$ sudo apt-get install php libapache2-mod-php php-xml php-gd php-mcrypt php-mysql php-intl php-curlAnswer Y to complete the installation.
$ a2query -m php7.0If it is not running, enable it:
$ sudo a2enmod php7.0and restart apache:
$ sudo service apache2 restart
sudo vi index.phpthen when the editor opens, type i to begin inserting text. When you are finished typing, escape, and type wq<enter> to write and quit the editor.
sudo apt-get install phpmyadmin
When the first prompt appears, press Space, Tab, and then Enter to select Apache. Select yes when asked to use dbconfig-common to set up the database. Provide your MariaDB root password Choose a password for the phpMyAdmin application itself.
Enable the necessary PHP extensions:
sudo phpenmod mcrypt
sudo phpenmod mbstring
Add this line to the bottom of /etc/apache2/apache2.conf
Include /etc/phpmyadmin/apache.conf
Restart Apache:
sudo service apache2 restartNow you can access phpMyAdmin on the following URL: http://localhost/phpmyadmin/
$ sudo apt install python-software-properties $ sudo add-apt-repository ppa:ondrej/php $ sudo add-apt-repository ppa:ondrej/apache2
$ sudo apt update $ sudo apt install php5.6 php5.6-fpm php5.6-xml php5.6-gd php5.6-mcrypt php5.6-intl php5.6-mysql php5.6-curl $ sudo apt install php7.1 php7.1-fpm php7.1-xml php7.1-gd php7.1-mcrypt php7.1-intl php7.1-mysql php7.1-curl $ sudo apt install php7.2 php7.2-fpm php7.2-xml php7.2-gd php7.2-mcrypt php7.2-intl php7.2-mysql php7.2-curlAfter installation, php-fpm services will not be started automatically. Use the following commands to make sure all versions of php are installed.
$ sudo update-alternatives --config phpand these commands to start a specific service
$ sudo service php5.6-fpm start
$ sudo service php7.2-fpm startEdit the php.ini file to enable pdo – look for the line “extension=php_pdo_mysql.dll” and remove the ; at the front of it. Do this for each version of php-fpm you installed. The files are in /etc/php/*/fpm/php.ini where * is the php version number.
$ sudo a2enmod actions fcgid alias proxy_fcgi
$ ln -s full-path-to-web-files-on-your-pc directory-name-for-siteI am going to add a site that needs 5.6 and one that needs 7.2
<FilesMatch> SetHandler "proxy:unix:/var/run/php/php5.6-fpm.sock|fcgi://localhost/" </FilesMatch>
Next Steps
Add SSL – https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-apache-in-ubuntu-16-04 (skip firewall step)
https://medium.com/@thomas.schmidt.0001/how-to-use-ubuntu-bash-on-windows-10-as-the-intellij-idea-terminal-334fd9a10d8c
https://getcomposer.org/download/
https:// tecadmin . net/install-redis-ubuntu/
https:// tecadmin . net/install-memcached-with-php-on-ubuntu/
Test
Don’t do it. Just don’t.
But suppose someone commits and then reverts a branch with a million files in it. It happens /vendor – I’m looking at you, here.
git config --add remote.origin.push '+refs/tags/*:refs/tags/*'
git config --add remote.origin.push '+refs/heads/*:refs/heads/*'
for remote_branch in `git branch --all | grep -v HEAD | sed -e 's/\*//'`; do local_branch=`echo $remote_branch | sed -e 's!remotes/origin/!!'`; git checkout $local_branch; done
git filter-branch --commit-filter '
case $GIT_COMMIT in
862ff2e9fc5926646bb9381e1a977c806e6f3e9e|862ff2e9fc5926646bb9381e1a977c806e6f3e9e)
skip_commit "$@"
;;
*)
git commit-tree "$@"
;;
esac' --tag-name-filter cat -- --all; git reflog expire --expire=now --all; git gc --aggressive --prune=now
Plugins can not be used on following:
__construct
Magento\Framework\Interception
is bootstrappedpublic function match (\Magento\Framework\App\RequestInterface $request) { if (strpos($request->getPathInfo(), 'test') === false) return; $request->setModuleName(‘MyCompany_MyModule’) ->setControllerName('test')->setActionName('test'); return $this->actionFactory->create( \Magento\Framework\App\Action\Forward::class, ['request' => $request] ); }
https://magento.stackexchange.com/questions/135532/magento-2-ce-front-controller-reached-100-router-match-iterations-issue
All the different type of form fields available in magento are located in folder lib\Varien\Data\Form\Element
Here is how to add a text field to an admin form, with a list of all the options
$fieldset->addField('title', 'text', array( 'label' => Mage::helper('form')->__('Title3'), 'class' => 'required-entry', 'required' => true, 'name' => 'title', 'onclick' => "alert('on click');", 'onchange' => "alert('on change');", 'style' => "border:10px", 'value' => 'hello !!', 'disabled' => false, 'readonly' => true, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('time', 'time', array( 'label' => Mage::helper('form')->__('Time'), 'class' => 'required-entry', 'required' => true, 'name' => 'title', 'onclick' => "", 'onchange' => "", 'value' => '12,04,15', 'disabled' => false, 'readonly' => false, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('textarea', 'textarea', array( 'label' => Mage::helper('form')->__('TextArea'), 'class' => 'required-entry', 'required' => true, 'name' => 'title', 'onclick' => "", 'onchange' => "", 'value' => '<b><b/>', 'disabled' => false, 'readonly' => false, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('submit', 'submit', array( 'label' => Mage::helper('form')->__('Submit'), 'required' => true, 'value' => 'Submit', 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('select', 'select', array( 'label' => Mage::helper('form')->__('Select'), 'class' => 'required-entry', 'required' => true, 'name' => 'title', 'onclick' => "", 'onchange' => "", 'value' => '1', 'values' => array('-1'=>'Please Select..','1' => 'Option1','2' => 'Option2', '3' => 'Option3'), 'disabled' => false, 'readonly' => false, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
Here is another version of the drop down
$fieldset->addField('select2', 'select', array( 'label' => Mage::helper('form')->__('Select Type2'), 'class' => 'required-entry', 'required' => true, 'name' => 'title', 'onclick' => "", 'onchange' => "", 'value' => '4', 'values' => array( '-1'=>'Please Select..', '1' => array( 'value'=> array(array('value'=>'2' , 'label' => 'Option2') , array('value'=>'3' , 'label' =>'Option3') ), 'label' => 'Size' ), '2' => array( 'value'=> array(array('value'=>'4' , 'label' => 'Option4') , array('value'=>'5' , 'label' =>'Option5') ), 'label' => 'Color' ), ), 'disabled' => false, 'readonly' => false, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('radio', 'radio', array( 'label' => Mage::helper('form')->__('Radio'), 'name' => 'title', 'onclick' => "", 'onchange' => "", 'value' => '1', 'disabled' => false, 'readonly' => false, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('radio2', 'radios', array( 'label' => Mage::helper('form')->__('Radios'), 'name' => 'title', 'onclick' => "", 'onchange' => "", 'value' => '2', 'values' => array( array('value'=>'1','label'=>'Radio1'), array('value'=>'2','label'=>'Radio2'), array('value'=>'3','label'=>'Radio3'), ), 'disabled' => false, 'readonly' => false, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('password', 'password', array( 'label' => Mage::helper('form')->__('Password'), 'class' => 'required-entry', 'required' => true, 'name' => 'title', 'onclick' => "", 'onchange' => "", 'style' => "", 'value' => 'hello !!', 'disabled' => false, 'readonly' => false, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('obscure', 'obscure', array( 'label' => Mage::helper('form')->__('Obscure'), 'class' => 'required-entry', 'required' => true, 'name' => 'obscure', 'onclick' => "", 'onchange' => "", 'style' => "", 'value' => '123456789', 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('note', 'note', array( 'text' => Mage::helper('form')->__('Text Text'), ));
$fieldset->addField('multiselect2', 'multiselect', array( 'label' => Mage::helper('form')->__('Select Type2'), 'class' => 'required-entry', 'required' => true, 'name' => 'title', 'onclick' => "return false;", 'onchange' => "return false;", 'value' => '4', 'values' => array( '-1'=> array( 'label' => 'Please Select..', 'value' => '-1'), '1' => array( 'value'=> array(array('value'=>'2' , 'label' => 'Option2') , array('value'=>'3' , 'label' =>'Option3') ), 'label' => 'Size' ), '2' => array( 'value'=> array(array('value'=>'4' , 'label' => 'Option4') , array('value'=>'5' , 'label' =>'Option5') ), 'label' => 'Color' ), ), 'disabled' => false, 'readonly' => false, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('multiline', 'multiline', array( 'label' => Mage::helper('form')->__('Multi Line'), 'class' => 'required-entry', 'required' => true, 'name' => 'title', 'onclick' => "", 'onchange' => "", 'style' => "border:10px", 'value' => 'hello !!', 'disabled' => false, 'readonly' => true, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('link', 'link', array( 'label' => Mage::helper('form')->__('Link'), 'style' => "", 'href' => 'www.excellencemagentoblog.com', 'value' => 'Magento Blog', 'after_element_html' => '' ));
$fieldset->addField('label', 'label', array( 'value' => Mage::helper('form')->__('Label Text'), ));
$fieldset->addField('image', 'image', array( 'value' => 'http://www.excellencemagentoblog.com/wp-content/themes/excelltheme/images/logo.png', ));
$fieldset->addField('file', 'file', array( 'label' => Mage::helper('form')->__('Upload'), 'value' => 'Uplaod', 'disabled' => false, 'readonly' => true, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('date', 'date', array( 'label' => Mage::helper('form')->__('Date'), 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ));
$fieldset->addField('checkbox', 'checkbox', array( 'label' => Mage::helper('form')->__('Checkbox'), 'name' => 'Checkbox', 'checked' => false, 'onclick' => "", 'onchange' => "", 'value' => '1', 'disabled' => false, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
$fieldset->addField('checkboxes', 'checkboxes', array( 'label' => Mage::helper('form')->__('Checkboxs'), 'name' => 'Checkbox', 'values' => array( array('value'=>'1','label'=>'Checkbox1'), array('value'=>'2','label'=>'Checkbox2'), array('value'=>'3','label'=>'Checkbox3'), ), 'onclick' => "", 'onchange' => "", 'value' => '1', 'disabled' => false, 'after_element_html' => '<small>Comments</small>', 'tabindex' => 1 ));
In an effort to simplify the Magento installation and upgrade process, 2.3 introduces declarative schema.
With the new declarative schema approach allows, developers are no longer forced to write scripts for each new version of a module. Using declarative schema, developers declare the final desired state of the database, and the system adjusts to it automatically, without performing redundant operations. In addition, this approach allows data to be easily deleted when a module is uninstalled.
There are two parts to using declarative schema: the db_schema.xml file and the bin/magento command to register it.
Once you use declarative schema in a module, you cannot use setup/upgrade scripts again. In the future, upgrade scripts will be phased out in favor of declarative schema.
The following example, extracted from the Catalog/etc/db_schema.xml
file, defines the catalog_product_entity_datetime
table:
<table name="catalog_product_entity_datetime" resource="default" engine="innodb"
comment="Catalog Product Datetime Attribute Backend Table">
<column xsi:type="int" name="value_id" padding="11" unsigned="false" nullable="false" identity="true" comment="Value ID"/>
<column xsi:type="smallint" name="attribute_id" padding="5" unsigned="true" nullable="false" identity="false"default="0" comment="Attribute ID"/>
<column xsi:type="smallint" name="store_id" padding="5" unsigned="true" nullable="false" identity="false" default="0" comment="Store ID"/>
<column xsi:type="int" name="entity_id" padding="10" unsigned="true" nullable="false" identity="false" default="0"/>
<column xsi:type="datetime" name="value" on_update="false" nullable="true" comment="Value"/>
<constraint xsi:type="primary" name="PRIMARY">
<column name="value_id"/>
</constraint>
</table>