@@ -654,6 +654,8 @@ class Meta:
654654 dict (help = 'Use PageSpeed for site' ,
655655 action = 'store' or 'store_const' ,
656656 choices = ('on' , 'off' ), const = 'on' , nargs = '?' )),
657+ (['--proxy' ],
658+ dict (help = "update to prxy site" , nargs = '+' )),
657659 (['--all' ],
658660 dict (help = "update all sites" , action = 'store_true' )),
659661 ]
@@ -701,6 +703,21 @@ def doupdatesite(self, pargs):
701703 Log .error (self , "Please provide valid options combination for"
702704 " site update" )
703705
706+ if stype is None and pargs .proxy :
707+ stype , cache = 'proxy' , ''
708+ proxyinfo = pargs .proxy [0 ].strip ()
709+ if not proxyinfo :
710+ Log .error (self , "Please provide proxy server host information" )
711+ proxyinfo = proxyinfo .split (':' )
712+ host = proxyinfo [0 ].strip ()
713+ port = '80' if len (proxyinfo ) < 2 else proxyinfo [1 ].strip ()
714+ elif stype is None and not pargs .proxy :
715+ stype , cache = 'html' , 'basic'
716+ elif stype and pargs .proxy :
717+ Log .error (self , "--proxy can not be used with other site types" )
718+ if (pargs .proxy and (pargs .pagespeed or pargs .hhvm )):
719+ Log .error (self , "Proxy site can not run on pagespeed or hhvm" )
720+
704721 if not pargs .site_name :
705722 try :
706723 while not pargs .site_name :
@@ -757,6 +774,18 @@ def doupdatesite(self, pargs):
757774 format (oldsitetype , oldcachetype , stype , cache ))
758775 return 1
759776
777+ if stype == 'proxy' :
778+ data ['site_name' ] = ee_domain
779+ data ['www_domain' ] = ee_www_domain
780+ data ['proxy' ] = True
781+ data ['host' ] = host
782+ data ['port' ] = port
783+ pagespeed = False
784+ hhvm = False
785+ data ['webroot' ] = ee_site_webroot
786+ data ['currsitetype' ] = oldsitetype
787+ data ['currcachetype' ] = oldcachetype
788+
760789 if stype == 'php' :
761790 data = dict (site_name = ee_domain , www_domain = ee_www_domain ,
762791 static = False , basic = True , wp = False , w3tc = False ,
@@ -926,6 +955,13 @@ def doupdatesite(self, pargs):
926955 "`tail /var/log/ee/ee.log` & Try Again!!!" )
927956 return 1
928957
958+ if 'proxy' in data .keys () and data ['proxy' ]:
959+ updateSiteInfo (self , ee_domain , stype = stype , cache = cache ,
960+ hhvm = hhvm , pagespeed = pagespeed )
961+ Log .info (self , "Successfully updated site"
962+ " http://{0}" .format (ee_domain ))
963+ return 0
964+
929965 # Update pagespeed config
930966 if pargs .pagespeed :
931967 operateOnPagespeed (self , data )
0 commit comments