Code Duplication    Length = 34-37 lines in 2 locations

Classes/Service/InstallService.php 2 locations

@@ 61-94 (lines=34) @@
58
	 * @param string $htaccessFile Path of .htaccess file
59
	 * @return void
60
	 */
61
    public function createDefaultHtaccessFile(){
62
        $htaccessFile = GeneralUtility::getFileAbsFileName(".htaccess");
63
                
64
        if(file_exists($htaccessFile)){
65
            
66
            /**
67
             * Add Flashmessage that there is already an .htaccess file and we are not going to override this.
68
             */
69
            $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
70
                'There is already an Apache .htaccess file in the root directory, please make sure that the url rewritings are set properly.'
71
                . 'An example configuration is located at: typo3conf/ext/moox_core/Configuration/Apache/.htaccess',
72
                'Apache .htaccess file already exists',
73
                FlashMessage::NOTICE,
74
                TRUE
75
            );
76
            $this->addFlashMessage($flashMessage);
77
			return;
78
	}
79
                   
80
        $htaccessContent = GeneralUtility::getUrl(ExtensionManagementUtility::extPath($this->extKey).'/Configuration/Apache/_.htaccess');
81
        GeneralUtility::writeFile($htaccessFile, $htaccessContent, TRUE);
82
        
83
        /**
84
         * Add Flashmessage that the example htaccess file was placed in the root directory
85
         */
86
        $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
87
            'For RealURL and optimization purposes an example .htaccess file was placed in your root directory.'
88
            . ' Please check if the RewriteBase correctly set for your environment. ',
89
            'Apache example .htaccess was placed in the root directory.',
90
            FlashMessage::OK,
91
            TRUE
92
       );
93
       $this->addFlashMessage($flashMessage);
94
    }
95
96
	/**
97
	 * Creates AdditionalConfiguration.php file inside the typo3conf directory
@@ 102-138 (lines=37) @@
99
	 * @param string $configurationFile Path of AdditionalConfiguration.php file
100
	 * @return void
101
	 */
102
	public function createDefaultAdditionalConfiguration($extension = NULL){
103
		if($extension == $this->extKey){
104
105
			$configurationFile = GeneralUtility::getFileAbsFileName("typo3conf/AdditionalConfiguration.php");
106
107
			if(file_exists($configurationFile)){
108
109
				/**
110
				 * Add Flashmessage that there is already an AdditionalConfiguration.php file and we are not going to override this.
111
				 */
112
				$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
113
						'There is already an AdditionalConfiguration file in the typo3conf directory, please make this line to your configuration "$GLOBALS[\'TYPO3_CONF_VARS\'][\'FE\'][\'contentRenderingTemplates\'] = array(\'mooxcore/Configuration/TypoScript/\');".'
114
						. 'An example configuration is located at: typo3conf/ext/moox_core/Configuration/AdditionalConfiguration/AdditionalConfiguration.php',
115
						'AdditionalConfiguration.php file already exists',
116
						FlashMessage::NOTICE,
117
						TRUE
118
				);
119
				$this->addFlashMessage($flashMessage);
120
				return;
121
			}
122
123
			$configurationContent = GeneralUtility::getUrl(ExtensionManagementUtility::extPath($this->extKey).'/Configuration/AdditionalConfiguration/AdditionalConfiguration.php');
124
			GeneralUtility::writeFile($configurationFile, $configurationContent, TRUE);
125
126
			/**
127
			 * Add Flashmessage that the example AdditionalConfiguration.php file was placed in the typo3conf directory
128
			 */
129
			$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
130
					'AdditionalConfiguration.php file was placed in your typo3conf directory.',
131
					'AdditionalConfiguration.php was placed in the typo3conf directory.',
132
					FlashMessage::OK,
133
					TRUE
134
			);
135
			$this->addFlashMessage($flashMessage);
136
137
		}
138
	}
139
140
	/**
141
	 * Creates robots.txt file inside the root directory