Get admin details Magento 2

To get magento admin details programatically you need to add below mentioned code in your class. protected $_authSession; public function __construct( ... \Magento\Backend\Model\Auth\Session $authSession, ... ) { ... $this->_authSession = $authSession; ... } public function getAdminUser(){ $user = $this->_authSession->getUser(); //You will get below mentioned admin information. $user->getUserId(); $user->getFirstname(); $user->getLastname(); $user->getEmail(); $user->getUsername(); $user->getPassword(); $user->getCreated(); $user->getModified(); $user->getLogdate(); $user->getLognum(); $user->getReloadAclFlag(); $user->getIsActive(); $user->getExtra(); $user->getRpToken(); $user->getRpTokenCreatedAt(); $user->getInterfaceLocale(); $user->getFailuresNum(); $user->getFirstFailure(); $user->getLockExpires();...
Upgrade magento 2 to latest version

Upgrade magento 2 to latest version

Upgrade magento 2 to latest version Note : Before running upgrade should have to take database and file backup. To upgrade magento 2 from UI you have to follow below mentioned document. http://devdocs.magento.com/guides/v2.0/comp-mgr/upgrader/upgrade-start.html To upgrade magento 2 with composer or command line or SSH use below mentioned command. First of all you you need to update composer. composer update After that check magento version if version is still same use below mentioned command. You have to update magento installer first so apply below mentioned command. composer require magento/magento-composer-installer composer require magento/product-community-edition '2.0.*' --no-update Now you have to run composer update command so it will upgrade php dependency and latest magento packages. composer update Now after done with upgrading all magento and php packages you have to run run below command to make sure that all database base updates are done. php bin/magento setup:upgrade Enjoy your magento 2 should upgraded in latest magento...
Install ClamAV and Scan Viruses with ClamAV

Install ClamAV and Scan Viruses with ClamAV

Installing ClamAV in UBUNTU sudo apt-get install clamav After installation you have to update ClamAV sudo freshclam For scan viruses you have to use below mentioned command. clamscan OPTIONS File/Folder Below mentioned command will check all files in root and displaying the name of each file: clamscan -r / Below mentioned command will check all files in root but only display infected files and ring a bell when found: clamscan -r --bell -i / Below mentioned command will check all files in root but only display infected files when found and have this run in the background: clamscan -r -i / & Below mentioned command will check files in the all users home directories: clamscan -r /home Below mentioned command will check files in the USER home directory and move infected files to another folder: clamscan -r --move=/home/USER/VIRUS /home/USER Below mentioned command will check files in the USER home directory and remove infected files (WARNING: Files are gone.): clamscan -r --remove /home/USER To see all available help options: clamscan --help Note: To see running background process use below mentioned command....
Install and configure solr Manually with Magento

Install and configure solr Manually with Magento

Install and configure solr Manually with Magento Install solr in UBUNTU with command line. Please find below mentioned command for installation. sudo apt-get -y install openjdk-7-jdk cd /opt sudo http://archive.apache.org/dist/lucene/solr/4.7.2/solr-4.7.2.tgz sudo tar -xvf solr-4.7.2.tgz sudo cp -R solr-4.7.2/example /opt/solr cd /opt/solr java -jar start.jar Now check solr running on your server or not with http://yourip:8983 sudo vi /etc/default/jetty Copy the below mentioned text into the file and press ESC the :wq and enter. NO_START=0 # Start on boot JAVA_OPTIONS="-Dsolr.solr.home=/opt/solr/solr $JAVA_OPTIONS" JAVA_HOME=/usr/java/default JETTY_HOME=/opt/solr JETTY_USER=solr JETTY_LOGS=/opt/solr/logs Create one more file sudo vi /opt/solr/etc/jetty-logging.xml Copy the below mentioned text into the file and press ESC the :wq and enter. <?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <!-- =============================================================== --> <!-- Configure stderr and stdout to a Jetty rollover log file --> <!-- this configuration file should be used in combination with --> <!-- other configuration files. e.g. --> <!-- java -jar start.jar etc/jetty-logging.xml etc/jetty.xml --> <!-- =============================================================== --> <Configure id="Server" class="org.mortbay.jetty.Server"> <New id="ServerLog" class="java.io.PrintStream"> <Arg> <New class="org.mortbay.util.RolloverFileOutputStream"> <Arg><SystemProperty name="jetty.logs" default="."/>/yyyy_mm_dd.stderrout.log</Arg> <Arg type="boolean">false</Arg> <Arg type="int">90</Arg> <Arg><Call class="java.util.TimeZone" name="getTimeZone"><Arg>GMT</Arg></Call></Arg> <Get id="ServerLogName" name="datedFilename"/> </New> </Arg> </New> <Call class="org.mortbay.log.Log" name="info"><Arg>Redirecting stderr/stdout to <Ref id="ServerLogName"/></Arg></Call> <Call class="java.lang.System" name="setErr"><Arg><Ref id="ServerLog"/></Arg></Call> <Call class="java.lang.System" name="setOut"><Arg><Ref id="ServerLog"/></Arg></Call> </Configure> Now create solr user and permission : sudo useradd -d /opt/solr -s /sbin/false solr sudo chown solr:solr -R /opt/solr create solr startup : sudo wget -O /etc/init.d/jetty https://cheppers.com/sites/default/files/attachments/jetty_0.txt sudo chmod a+x /etc/init.d/jetty sudo update-rc.d jetty defaults sudo /etc/init.d/jetty start Now configuring the magento for...
Disable Magento compiler

Disable Magento compiler

Disable Magento compiler (Magento 1.x) You can disable the compiler from ssh using terminal in ubuntu or in windows using putty. login to server with ssh and go to magentoroot\shell and use below mentioned commands. php -f compiler.php clear php -f compiler.php disable You can also run the command from php files if you not have ssh create a php file called cmpdisable.php and write below mentioned code and upload it in magentoroot folder and heat url www.yoursite.com/cmpdisable.php echo exec('./shell/php -f compiler.php clear'); echo exec('./shell/php -f compiler.php disable'); Note : this is only work if your server allowed exec php method. if this will not help then use below mentioned process open file magentoroot/includes/config.php file to disable compilation in Magento, edit includes/config.php and comment this code. #define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src'); #define('COMPILER_COLLECT_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'stat'); Hope this will help you to disable the compilation....