<commit_before><?php

  include_once('inc/OSFInstaller.php');

  class OSFInstaller_Ubuntu_14_04 extends OSFInstaller
  {
    public function installPhp5()
    {
      $this->cecho("\n\n", 'WHITE');
      $this->cecho("-----------------\n", 'WHITE');
      $this->cecho(" Installing PHP5 \n", 'WHITE');
      $this->cecho("-----------------\n", 'WHITE');
      $this->cecho("\n\n", 'WHITE');

      passthru('apt-get -y install php5');      
      
      passthru('apt-get -y install php5-curl');      
      
      $this->cecho("Restarting Apache2...\n", 'WHITE');
      $this->exec('/etc/init.d/apache2 restart');      

      $this->chdir($this->currentWorkingDirectory);
    }    
    
    /**
    * Install Virtuoso as required by OSF
    */
    public function installVirtuoso()
    {

      $this->cecho("\n\n", 'WHITE');
      $this->cecho("---------------------\n", 'WHITE');
      $this->cecho(" Installing Virtuoso 7 from .deb file.... \n", 'WHITE');
      $this->cecho("---------------------\n", 'WHITE');
      $this->cecho("\n\n", 'WHITE');   

      $this->wget('https://github.com/structureddynamics/OSF-Installer-Ext/raw/3.2/virtuoso-opensource/virtuoso-opensource_7.1_amd64.deb');
      $this->exec('dpkg -i virtuoso-opensource_7.1_amd64.deb');     
      
      $this->exec('mv /etc/init.d/virtuoso-opensource /etc/init.d/virtuoso');
      
      $isVirtuosoRunning = shell_exec('ps aux | grep virtuoso');
      
      if(strpos($isVirtuosoRunning, '/usr/bin/virtuoso') === FALSE)
      {
        $this->cecho('Virtuoso is not running. Check the logs, something went wrong.', 'RED');
      }
      else
      {
        $this->cecho("Register Virtuoso to automatically start at the system's startup...\n", 'WHITE');
        $this->exec('sudo update-rc.d virtuoso defaults');

        $dbaPassword = $this->getInput("Enter a password to use with the Virtuoso administrator DBA & DAV users");
	
        if(!$this->change_password($dbaPassword))
        {
          $dbaPassword = '<PASSWORD>';
          $this->cecho("\n\nThe Virtuoso admin password was not changed. Use the default and change it after this installation process...\n", 'YELLOW');
        }        
        
        $this->cecho("Grant the SPARQL_UPDATE role to the SPARQL user...\n", 'WHITE');

        if(!$this->update_sparql_roles($dbaPassword))
        {
          $this->cecho("\n\nCouldn't grant the SPARQL_UPDATE role to the SPARQL user automcatilly. Log into Conductor to add that role to that user otherwise the OSF instance won't be operational...\n", 'RED');
        }                
      }
      
      // Configuring Virtuoso to be able to access the files from the DMT tool<commit_msg>(1) Install unixodbc and php5-odbc (2) Install the odbc.ini and odbcinst.ini files<commit_after><?php

  include_once('inc/OSFInstaller.php');

  class OSFInstaller_Ubuntu_14_04 extends OSFInstaller
  {
    public function installPhp5()
    {
      $this->cecho("\n\n", 'WHITE');
      $this->cecho("-----------------\n", 'WHITE');
      $this->cecho(" Installing PHP5 \n", 'WHITE');
      $this->cecho("-----------------\n", 'WHITE');
      $this->cecho("\n\n", 'WHITE');

      passthru('apt-get -y install php5 php5-curl unixodbc php5-odbc');      
      
      $this->cecho("Restarting Apache2...\n", 'WHITE');
      $this->exec('/etc/init.d/apache2 restart');      

      $this->chdir($this->currentWorkingDirectory);
    }    
    
    /**
    * Install Virtuoso as required by OSF
    */
    public function installVirtuoso()
    {

      $this->cecho("\n\n", 'WHITE');
      $this->cecho("---------------------\n", 'WHITE');
      $this->cecho(" Installing Virtuoso 7 from .deb file.... \n", 'WHITE');
      $this->cecho("---------------------\n", 'WHITE');
      $this->cecho("\n\n", 'WHITE');   

      $this->wget('https://github.com/structureddynamics/OSF-Installer-Ext/raw/3.3/virtuoso-opensource/virtuoso-opensource_7.1_amd64.deb');
      $this->exec('dpkg -i virtuoso-opensource_7.1_amd64.deb');     
      
      $this->exec('mv /etc/init.d/virtuoso-opensource /etc/init.d/virtuoso');

      $this->cecho("Installing odbc.ini and odbcinst.ini files...\n", 'WHITE');
      
      $this->exec('cp -f resources/virtuoso/odbc.ini /etc/odbc.ini');
      $this->exec('cp -f resources/virtuoso/odbcinst.ini /etc/odbcinst.ini');

      $this->cecho("Test Virtuoso startup...\n", 'WHITE');
      
      $this->exec('/etc/init.d/virtuoso stop');
      
      sleep(20);
      
      $this->exec('/etc/init.d/virtuoso start');
      
      $isVirtuosoRunning = shell_exec('ps aux | grep virtuoso');
      
      if(strpos($isVirtuosoRunning, '/usr/bin/virtuoso') === FALSE)
      {
        $this->cecho('Virtuoso is not running. Check the logs, something went wrong.', 'RED');
      }
      else
      {
        $this->cecho("Register Virtuoso to automatically start at the system's startup...\n", 'WHITE');
        $this->exec('sudo update-rc.d virtuoso defaults');

        $dbaPassword = $this->getInput("Enter a password to use with the Virtuoso administrator DBA & DAV users");
	
        if(!$this->change_password($dbaPassword))
        {
          $dbaPassword = '<PASSWORD>';
          $this->cecho("\n\nThe Virtuoso admin password was not changed. Use the default and change it after this installation process...\n", 'YELLOW');
        }        
        
        $this->cecho("Grant the SPARQL_UPDATE role to the SPARQL user...\n", 'WHITE');

        if(!$this->update_sparql_roles($dbaPassword))
        {
          $this->cecho("\n\nCouldn't grant the SPARQL_UPDATE role to the SPARQL user automcatilly. Log into Conductor to add that role to that user otherwise the OSF instance won't be operational...\n", 'RED');
        }                
      }
      
      // Configuring Virtuoso to be able to access the files from the DMT tool
{'fraction_non_alphanumeric': 0.18574366004112405, 'fraction_numerical': 0.00822481151473612, 'mean_word_length': 2.2337950138504157, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 63, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7536854', 'n_tokens_mistral': 1979, 'n_tokens_neox': 1880, 'n_words': 408}