2017-10-31 9 views
1

안녕하세요 저는 Joomla!에서 첫 번째 모듈을 만들고 있습니다.모듈을 설치할 때 미디어 관리자에서 폴더를 만드는 방법

누군가 내 모듈을 설치할 때 Joomla!의 미디어 관리자에 새 폴더를 만들고 싶습니다. 나는 오리 오리가 있었고 몇 가지 정보를 발견했다. 그러나 나는 그것을 작동시킬 수 없다. 정보가 이전 Joomla! 버전. 아니면 잘못 구현했을 수도 있습니다. 사람이 방법을 추가하는 나를 설명 할 수

<?php 
$destination = JPATH_SITE."/images/mynewmap"; 
JFolder::create($destination); 
?> 

install.createmap.php

mod_mymodule.xml

<extension type="module" version="3.8.1" client="site" method="upgrade"> 
    <files> 
     <scriptfile>install.componentname.php</scriptfile> 
    </files> 
</extension> 

:

어쨌든 나는 다음과 함께했다 폴더를 Joomla 3에 모듈을 설치할 때 미디어 관리자 (루트/이미지)에 추가 하시겠습니까?

<?php 
// No direct access to this file 
defined('_JEXEC') or die; 

class mod_helloWorldInstallerScript 
{ 
    function install($parent) 
    { 
     echo '<p>The module has been installed</p>'; 
    } 

    function uninstall($parent) 
    { 
     echo '<p>The module has been uninstalled</p>'; 
    } 

    function update($parent) 
    { 
     echo '<p>The module has been updated to version' . $parent->get('manifest')->version . '</p>'; 
    } 

    function preflight($type, $parent) 
    { 
     echo '<p>Anything here happens before the installation/update/uninstallation of the module</p>'; 
    } 

    function postflight($type, $parent) 
    { 
     echo '<p>Anything here happens after the installation/update/uninstallation of the module</p>'; 
    } 
} 

그것은 몇 가지 방법으로 클래스를 포함

여기 https://docs.joomla.org/J3.x:Creating_a_simple_module/Adding_an_install-uninstall-update_script_file

는이 script.php 예제 내용입니다 :

답변

2

당신은 당신의 설치 작업을 실행하는이 script.php 파일이 필요합니다 필요한 폴더 구조를 만들 수 있습니다. 포스트 플라이트 방법을 확장하려고합니다.

+0

설치 방법이 아닌 포스트 플라이트 방식으로 새 폴더를 만들어야하는 이유에 대해 자세히 설명 할 수 있습니까? – RMo

+0

그 때 모든 것이 성공적 이었으므로 최종 설치 단계를 수행 할 수 있습니다. 그러나 결국, 이것은 당신에게 달렸습니다. –

+0

좋아. 설치시 해당 폴더를 추가하기 만하므로 설치 방법에 추가 할 것입니다. postflight가 업데이트 및 제거 후에도 코드를 실행한다고 가정합니다. 원하지 않는 코드입니다. 답장을위한 Thx. – RMo