Created
October 24, 2011 03:08
-
-
Save s992/1308277 to your computer and use it in GitHub Desktop.
MuraProxy plugin deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Instantiate the MuraProxy webservice ---> | |
<cfset muraProxy = createObject( "webservice", "http://localhost/muraFork/MuraProxy.cfc?wsdl" ) /> | |
<!--- Authenticate ---> | |
<cfset authToken = muraProxy.login( 'admin', 'admin', 'default' ) /> | |
<!--- Create our args struct and serialize it to place in the URL ---> | |
<cfset args = structNew() /> | |
<cfset args.siteID = 'default' /> | |
<cfset args = serializeJSON( args ) /> | |
<cfoutput> | |
<!--- | |
This form contains everything else we need. For some reason, I had to specify args in the URL instead of as a hidden | |
input. | |
---> | |
<form action="http://localhost/muraFork/MuraProxy.cfc?args=#urlEncodedFormat(args)#" method="post" enctype="multipart/form-data"> | |
<input type="hidden" name="method" value="call" /> | |
<input type="hidden" name="serviceName" value="plugin" /> | |
<input type="hidden" name="methodName" value="deploy" /> | |
<input type="hidden" name="authToken" value="#authToken#" /> | |
<input type="file" name="bundleFile" /> | |
<input type="Submit" value="Submit" /> | |
</form> | |
</cfoutput> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfcomponent output="false" extends="service"> | |
<cffunction name="deploy" output="false"> | |
<cfargument name="event"> | |
<cfset var fileManager = getBean("fileManager")> | |
<cfset var tempfile = ""> | |
<cfset var errors = structNew()> | |
<cftry> | |
<cffile action="upload" result="tempFile" filefield="bundleFile" nameconflict="makeunique" destination="#application.configBean.getTempDir()#"> | |
<cfset application.pluginManager.announceEvent("onBeforeProxyBundleDeploy", event)> | |
<cfset application.pluginManager.deployPlugin( | |
siteID=arguments.event.getValue( 'siteID' ), | |
pluginFile="#tempfile.serverDirectory#/#tempfile.serverFilename#.#tempfile.serverFileExt#") /> | |
<cffile action="delete" file="#tempfile.serverDirectory#/#tempfile.serverFilename#.#tempfile.serverFileExt#"> | |
<cfset event.setValue("__response__", "success")> | |
<cfset application.pluginManager.announceEvent("onAfterProxyBundleDeploy", event)> | |
<cfcatch> | |
<cfset event.setValue("__response__", cfcatch.Message)> | |
</cfcatch> | |
</cftry> | |
</cffunction> | |
</cfcomponent> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment